onclose
This commit is contained in:
parent
76d31322ae
commit
ff61aefaea
2 changed files with 9 additions and 0 deletions
|
|
@ -31,10 +31,12 @@ namespace MwCXX {
|
|||
virtual void OnColorChosen(MwRGB value) {};
|
||||
virtual void OnFileChosen(MwCXX::String value) {};
|
||||
virtual void OnDirectoryChosen(MwCXX::String value) {};
|
||||
virtual void OnClose() {};
|
||||
|
||||
void (*ColorChosenHandler)(MwCXX::Window* widget, MwRGB value);
|
||||
void (*FileChosenHandler)(MwCXX::Window* widget, MwCXX::String value);
|
||||
void (*DirectoryChosenHandler)(MwCXX::Window* widget, MwCXX::String value);
|
||||
void (*CloseHandler)(MwCXX::Window* widget);
|
||||
};
|
||||
}; // namespace MwCXX
|
||||
|
||||
|
|
|
|||
|
|
@ -77,12 +77,19 @@ static void __OnDirectoryChosen(MwWidget handle, void* user, void* call) {
|
|||
if(((MwCXX::Window*)user)->DirectoryChosenHandler != NULL) ((MwCXX::Window*)user)->DirectoryChosenHandler((MwCXX::Window*)user, (MwCXX::String)(char*)call);
|
||||
}
|
||||
|
||||
static void __OnClose(MwWidget handle, void* user, void* call) {
|
||||
((MwCXX::Window*)user)->OnClose();
|
||||
if(((MwCXX::Window*)user)->CloseHandler != NULL) ((MwCXX::Window*)user)->CloseHandler((MwCXX::Window*)user);
|
||||
}
|
||||
|
||||
void MwCXX::Window::RegisterHandlers() {
|
||||
MwAddUserHandler(this->widget, MwNcolorChosenHandler, __OnColorChosen, (void*)this);
|
||||
MwAddUserHandler(this->widget, MwNfileChosenHandler, __OnFileChosen, (void*)this);
|
||||
MwAddUserHandler(this->widget, MwNdirectoryChosenHandler, __OnDirectoryChosen, (void*)this);
|
||||
MwAddUserHandler(this->widget, MwNcloseHandler, __OnClose, (void*)this);
|
||||
|
||||
this->ColorChosenHandler = NULL;
|
||||
this->FileChosenHandler = NULL;
|
||||
this->DirectoryChosenHandler = NULL;
|
||||
this->CloseHandler = NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue