123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- #ifndef __CHECKBOX_H
- #define __CHECKBOX_H
- #include <api/wnd/wndclass/guiobjwnd.h>
- #include <api/script/objects/c_script/h_guiobject.h>
- #include <api/script/objects/c_script/h_button.h>
- #define CHECKBOX_PARENT GuiObjectWnd
- class TextClicks;
- class ToggleClicks;
- /**
- Class
- @short
- @author Nullsoft
- @ver 1.0
- @see
- */
- class CheckBox : public CHECKBOX_PARENT {
-
- public:
- CheckBox(const wchar_t *_text = L"ERROR", const wchar_t *_radioid = NULL);
- virtual ~CheckBox();
-
- /**
- Method
-
- @see
- @ret
- @param
- */
- virtual int onInit();
-
- /**
- Method
-
- @see
- @ret
- @param
- */
- virtual int getPreferences(int what);
-
- /**
- Method
-
- @see
- @ret
- @param
- */
- void toggle(int self_switch); // this is called by the click catchers.
- /**
- Method
-
- @see
- @ret
- @param
- */
- void setActivated(int activated, int writetocfg=1);
-
- /**
- Method
-
- @see
- @ret
- @param
- */
- int isActivated();
-
- /**
- Method
-
- @see
- @ret
- @param
- */
- void setText(const wchar_t *_text);
- const wchar_t *getText();
- void setRadioid(const wchar_t *_radioid);
- const wchar_t *getRadioid() { return radioid; }
- void setRadioVal(const wchar_t *val, int use_radioval=TRUE);
- const wchar_t *getRadioVal() { return radioval; }
-
- #ifdef WASABI_COMPILE_CONFIG
- /**
- Method
-
- @see
- @ret
- @param
- */
- virtual int onReloadConfig();
- #endif
-
- /**
- Method
-
- @see
- @ret
- @param
- */
- virtual void onNewContent();
- virtual int wantFocus() { return 1; }
- virtual int onChar(unsigned int c);
- virtual void setAction(const wchar_t *str);
- virtual void setActionTarget(const wchar_t *target);
- virtual void setActionParam(const wchar_t *param);
- virtual const wchar_t *getActionParam();
- protected:
- virtual void onToggle(); //override to catch toggles
- private:
- void doAction();
-
- /**
- Method
-
- @see
- @ret
- @param
- */
- void updateText();
- TextClicks *textclicks;
- ToggleClicks *toggleclicks;
- StringW text;
- StringW radioid;
- GuiObject *buttonGuiObj;
- StringW radioval;
- int use_radioval;
- StringW action, action_target, action_param;
- };
- /**
- Class
- @short
- @author Nullsoft
- @ver 1.0
- @see
- */
- class TextClicks : public H_GuiObject {
- public:
-
- /**
- Method
-
- @see
- @ret
- @param
- */
- TextClicks(ScriptObject *textobj, CheckBox *_callback) :
-
- /**
- Method
-
- @see
- @ret
- @param
- */
- callback(_callback), H_GuiObject(textobj) {
- }
-
- /**
- Method
-
- @see
- @ret
- @param
- */
- virtual void hook_onLeftButtonDown(int x, int y) {
- callback->toggle(0);
- }
- private:
- CheckBox *callback;
- };
- /**
- Class
- @short
- @author Nullsoft
- @ver 1.0
- @see
- */
- class ToggleClicks : public H_Button {
- public:
-
- /**
- Method
-
- @see
- @ret
- @param
- */
- ToggleClicks(ScriptObject *button, CheckBox *_callback) :
-
- /**
- Method
-
- @see
- @ret
- @param
- */
- callback(_callback), H_Button(button) {
- inhere=0;
- }
-
- /**
- Method
-
- @see
- @ret
- @param
- */
- virtual void hook_onActivate(int activate) {
- if (inhere) return;
- inhere=1;
- callback->toggle(1);
- inhere=0;
- }
- private:
- CheckBox *callback;
- int inhere;
- };
- #endif
|