#include <event.h>
template<typename object_t, typename handler_t>
class xtd::event< object_t, handler_t >
Represents an event.
- Namespace
- xtd
- Library
- xtd.core
- Template Parameters
-
object_t | the owner object type of the event. |
handler_t | Typically a xtd::event_handler or inherited type. |
- Examples
- The following example cshow hot to use event.
#include <xtd/xtd>
#include <iostream>
#include <string>
public:
if (text_ != text) {
text_ = text;
}
}
protected:
private:
};
public:
protected:
};
auto main()->int {
std::cout <<
"text_changed [text=" << as<control>(sender).
text() <<
"]" << std::endl;
};
button1.click += [] {
std::cout << "click on button1" << std::endl;
};
button1.text("button1");
button1.perform_click();
}
- Examples:
- colors.cpp, event.cpp, numeric_text_box.cpp, and send_message_to_form.cpp.
|
bool | is_empty () const noexcept |
| Gets a value indicate if the event is empty. More...
|
|
|
handler_t & | operator+= (const handler_t &handler) noexcept |
| Adds an handler to the event. More...
|
|
handler_t & | operator+= (const typename handler_t::function_t &function) noexcept |
| Adds a function to the event. More...
|
|
template<typename fn_t > |
handler_t & | operator+= (fn_t function) noexcept |
| Adds a function to the event. More...
|
|
handler_t & | operator-= (const handler_t &handler) noexcept |
| Removes an handler to the event. More...
|
|
handler_t & | operator-= (const typename handler_t::function_t &function) noexcept |
| Removes a function to the event. More...
|
|
template<typename fn_t > |
handler_t & | operator-= (fn_t function) noexcept |
| Removes a function to the event. More...
|
|
void | clear () noexcept |
| Clear event. More...
|
|
◆ clear()
template<typename object_t, typename handler_t>
◆ is_empty()
template<typename object_t, typename handler_t>
bool xtd::event< object_t, handler_t >::is_empty |
( |
| ) |
const |
|
inlinenoexcept |
Gets a value indicate if the event is empty.
- Returns
- true if evcent does not contains functions; otherwise false.
◆ operator+=() [1/3]
template<typename object_t, typename handler_t>
handler_t& xtd::event< object_t, handler_t >::operator+= |
( |
const handler_t & |
handler | ) |
|
|
inlinenoexcept |
Adds an handler to the event.
- Parameters
-
- Returns
- The current event instance.
◆ operator+=() [2/3]
template<typename object_t, typename handler_t>
handler_t& xtd::event< object_t, handler_t >::operator+= |
( |
const typename handler_t::function_t & |
function | ) |
|
|
inlinenoexcept |
Adds a function to the event.
- Parameters
-
- Returns
- The current event instance.
◆ operator+=() [3/3]
template<typename object_t, typename handler_t>
template<typename fn_t >
handler_t& xtd::event< object_t, handler_t >::operator+= |
( |
fn_t |
function | ) |
|
|
inlinenoexcept |
Adds a function to the event.
- Parameters
-
- Returns
- The current event instance.
◆ operator-=() [1/3]
template<typename object_t, typename handler_t>
handler_t& xtd::event< object_t, handler_t >::operator-= |
( |
const handler_t & |
handler | ) |
|
|
inlinenoexcept |
Removes an handler to the event.
- Parameters
-
handler | Handler to remove. |
- Returns
- The current event instance.
◆ operator-=() [2/3]
template<typename object_t, typename handler_t>
handler_t& xtd::event< object_t, handler_t >::operator-= |
( |
const typename handler_t::function_t & |
function | ) |
|
|
inlinenoexcept |
Removes a function to the event.
- Parameters
-
function | Function to remove. |
- Returns
- The current event instance.
◆ operator-=() [3/3]
template<typename object_t, typename handler_t>
template<typename fn_t >
handler_t& xtd::event< object_t, handler_t >::operator-= |
( |
fn_t |
function | ) |
|
|
inlinenoexcept |
Removes a function to the event.
- Parameters
-
function | Function to remove. |
- Returns
- The current event instance.
The documentation for this class was generated from the following file: