WINDEX
Public Member Functions | List of all members
wex::eventhandler Class Reference

A class where application code can register functions to be called when an event occurs. More...

#include <wex.h>

Public Member Functions

bool onLeftdown ()
 
void onRightDown ()
 
void onMouseUp ()
 
void onDoubleClick ()
 
void onDraw (PAINTSTRUCT &ps)
 
void onResize (int w, int h)
 
void onScrollH (int code)
 
void onScrollV (int code)
 
void onMenuCommand (int id)
 
void onKeydown (int keycode)
 
void onMouseMove (WPARAM wParam, LPARAM lParam)
 
void onMouseEnter ()
 
void onMouseWheel (int dist)
 
void onMouseLeave ()
 
void onTimer (int id)
 
bool onSelect (unsigned short id)
 
bool onChange (unsigned short id)
 
void onSlid (unsigned short id)
 
void onDropStart (HDROP hDrop)
 
void onDrop (const std::vector< std::string > &files)
 
void onAsyncReadComplete (int id)
 
void onTcpServerAccept ()
 
void onTcpServerReadComplete ()
 
bool onQuitApp ()
 
void onDatePicked (int idFrom, LPNMDATETIMECHANGE date)
 
void click (std::function< void(void)> f, bool propogate=false)
 register click event handler More...
 
void clickWex (std::function< void(void)> f)
 register a function to do some housekeeping when clicked, before calling handler registered by application code More...
 
void clickPropogate (bool f=true)
 specify that click event should propogate to parent window after currently registered click event handler runs
 
void clickRight (std::function< void(void)> f)
 
void clickDouble (std::function< void(void)> f)
 
void draw (std::function< void(PAINTSTRUCT &ps)> f)
 
void resize (std::function< void(int w, int h)> f)
 
void scrollH (std::function< void(int code)> f)
 
void scrollV (std::function< void(int code)> f)
 
int menuCommand (std::function< void(const std::string &title)> f, const std::string &title)
 Register function to run when menu item clicked. More...
 
void select (int id, std::function< void(void)> f)
 
void change (int id, std::function< void(void)> f)
 register function to call when control changes More...
 
void keydown (std::function< void(int keydown)> f)
 register function to call when key pressed. Function is passed key code.
 
void mouseEnter (std::function< void(void)> f)
 
void mouseMove (std::function< void(sMouse &m)> f)
 
void mouseWheel (std::function< void(int dist)> f)
 
void mouseUp (std::function< void(void)> f)
 
void mouseLeave (std::function< void(void)> f)
 
void timer (std::function< void(int id)> f)
 
void slid (std::function< void(int pos)> f)
 
void dropStart (std::function< void(HDROP hDrop)> f)
 register function to call when user drops files. App code should NOT call this!
 
void drop (std::function< void(const std::vector< std::string > &files)> f)
 register function to call when files dropped by user have been extracted. App code use this!
 
void asyncReadComplete (std::function< void(int id)> f)
 register function to call when an asynchronous read completes. More...
 
void tcpServerAccept (std::function< void(void)> f)
 
void tcpRead (std::function< void(void)> f)
 register function to call when tcp read accurs
 
void quitApp (std::function< bool(void)> f)
 register function to call when application is about to quit The function should return true to allow the quit to proceed.
 
void datePick (std::function< void(int, LPNMDATETIMECHANGE)> f)
 Register function to call when a date is picked. More...
 

Detailed Description

A class where application code can register functions to be called when an event occurs.

Member Function Documentation

◆ asyncReadComplete()

void wex::eventhandler::asyncReadComplete ( std::function< void(int id)>  f)
inline

register function to call when an asynchronous read completes.

The function parameter identifies the com class that completed the read

◆ change()

void wex::eventhandler::change ( int  id,
std::function< void(void)>  f 
)
inline

register function to call when control changes

Parameters
[in]idof control

◆ click()

void wex::eventhandler::click ( std::function< void(void)>  f,
bool  propogate = false 
)
inline

register click event handler

Parameters
[in]fthe function to call when user clicks on gui in order to process event
[in]propogatespecify that event should propogate to parent window after processing, default is false

A click occurs when the left mouse button is pressed

◆ clickWex()

void wex::eventhandler::clickWex ( std::function< void(void)>  f)
inline

register a function to do some housekeeping when clicked, before calling handler registered by application code

Parameters
[in]fthe function to call

This should NOT be called by application code.

For example, this looks after the check mark in checkboxes or the removal of the filled in dot of the other radio buttons in a group

◆ datePick()

void wex::eventhandler::datePick ( std::function< void(int, LPNMDATETIMECHANGE)>  f)
inline

Register function to call when a date is picked.

Parameters
ffunction

The notification is sent to the date picker widget's parent

The function is passed the id of the date picker widget and a pointer to the date change structure which can be used like this

fm.events().datePick(
[](int id,LPNMDATETIMECHANGE date)
{
    std::cout << "id " << id << " date changed to "
              << date->st.wYear << "/"
              << date->st.wMonth << "/"
              << date->st.wDay << " "
              << date->dwFlags << "\n";
});

Selecting a new date may call this funtion TWICE So if processing the new date is expensive check if the data has actually changed

◆ menuCommand()

int wex::eventhandler::menuCommand ( std::function< void(const std::string &title)>  f,
const std::string &  title 
)
inline

Register function to run when menu item clicked.

Parameters
[in]ffunction to run when menu item with id is clicked
[in]titleof menu item, passed as parameter to event handler
Returns
event handler index to be used as menu item index

The documentation for this class was generated from the following file: