Fork of SimpleGUI by Duncan McIntyre

Dialogs/OKCancelDialog.h

Committer:
duncanFrance
Date:
2016-05-21
Revision:
14:e6515b19f5a0
Child:
15:e69fd74d42e4

File content as of revision 14:e6515b19f5a0:

#ifndef SIMPLEGUI_OK_CANCEL_DIALOG_H
#define SIMPLEGUI_OK_CANCEL_DIALOG_H
#include "ContainerWidget.h"
/**
* A Dialog takes over the whole screen and offers some sort of control
* together with apply and cancel buttons
**/
class OKCancelDialog : public ContainerWidget
{
public:

    OKCancelDialog(GraphicsContext *context);

    template<typename T>
    void onOK(T* tptr, void (T::*mptr)(Event e)) {
        _onOK.attach(ptr, mptr);
    }

    template<typename T>
    void onCancel(T* tptr, void (T::*mptr)(Event e)) {
        _onCancel.attach(ptr, mptr);
    }
    
private:

    FunctionPointerArg1<void,Event> _onOK;
    FunctionPointerArg1<void,Event> _onCancel;
    
    void _handleOK(Event e);
    void _handleCancel(Event e);


};

#endif