el h / SimpleGUI

Fork of SimpleGUI by Duncan McIntyre

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers OKCancelDialog.h Source File

OKCancelDialog.h

00001 #ifndef SIMPLEGUI_OK_CANCEL_DIALOG_H
00002 #define SIMPLEGUI_OK_CANCEL_DIALOG_H
00003 #include "ContainerWidget.h"
00004 /**
00005 * A Dialog takes over the whole screen and offers some sort of control
00006 * together with apply and cancel buttons
00007 **/
00008 class OKCancelDialog : public ContainerWidget
00009 {
00010 public:
00011 
00012     OKCancelDialog(GraphicsContext *context);
00013 
00014     void onOK(void(* fn)(Event e)) {
00015         _onOK.attach(fn);
00016     }
00017     
00018     void onCancel(void(* fn)(Event e)) {
00019         _onCancel.attach(fn);
00020     }
00021     
00022     template<typename T>
00023     void onOK(T* tptr, void (T::*mptr)(Event e)) {
00024         _onOK.attach(tptr, mptr);
00025     }
00026 
00027     template<typename T>
00028     void onCancel(T* tptr, void (T::*mptr)(Event e)) {
00029         _onCancel.attach(tptr, mptr);
00030     }
00031     
00032 private:
00033 
00034     FunctionPointerArg1<void,Event> _onOK;
00035     FunctionPointerArg1<void,Event> _onCancel;
00036     
00037     void _handleOK(Event e);
00038     void _handleCancel(Event e);
00039 
00040 
00041 };
00042 
00043 #endif