1 /* -*- c++ -*- 2 FILE: Widgets.h 3 RCS REVISION: $Revision: 1.19 $ 4 5 COPYRIGHT: (c) 1999 -- 2003 Melinda Green, Don Hatch, and Jay Berkenbilt - Superliminal Software 6 7 LICENSE: Free to use and modify for non-commercial purposes as long as the 8 following conditions are adhered to: 9 1) Obvious credit for the source of this code and the designs it embodies 10 are clearly made, and 11 2) Ports and derived versions of 4D Magic Cube programs are not distributed 12 without the express written permission of the authors. 13 14 DESCRIPTION: 15 Generic Widgets interface. This class defines a generic 16 interface that can be used as a base class for the 17 machine-dependent (or sytem-dependent) code that handles the 18 creation of user interface objects on the display. 19 */ 20 21 #ifndef WIDGETS_H 22 #define WIDGETS_H 23 24 #include "EventHandler.h" 25 26 class Preferences; 27 class MacroManager; // XXX 28 29 class Widgets 30 { 31 public: ~Widgets()32 virtual ~Widgets() {}; 33 34 class ButtonData 35 { 36 public: 37 ButtonData(char *l = 0, 38 EventHandler::callback_fn cb = 0, 39 void* cbd = 0) : label(l)40 label(l), callback(cb), cb_arg(cbd) 41 { 42 } 43 char *label; 44 EventHandler::callback_fn callback; 45 void *cb_arg; 46 }; 47 48 // ButtonData* is an array 49 virtual void addMenuButton(char *name, int nbuttons, ButtonData*) = 0; 50 virtual void addButton(ButtonData) = 0; 51 virtual char* getMacroName(int i) = 0; 52 virtual void* addMacro(char* name, void* prev_ui_data) = 0; 53 virtual void removeMacro(void* ui_data) = 0; 54 55 // Create a dialog box with up to three buttons. 56 virtual void createDialog(char *s, int nbuttons, ButtonData*) = 0; 57 virtual void destroyDialog() = 0; 58 59 // Make fast button properly reflect state of fast_automoves 60 virtual void updateFastButton(int fast_automoves) = 0; 61 62 virtual void debuggingHack(MacroManager*) = 0; 63 64 protected: Widgets(Preferences & p)65 Widgets(Preferences& p) : 66 preferences(p) 67 { 68 } 69 Preferences& preferences; 70 }; 71 72 #endif 73 74 // Local Variables: 75 // c-basic-offset: 4 76 // c-comment-only-line-offset: 0 77 // c-file-offsets: ((defun-block-intro . +) (block-open . 0) (substatement-open . 0) (statement-cont . +) (statement-case-open . +4) (arglist-intro . +) (arglist-close . +) (inline-open . 0)) 78 // indent-tabs-mode: nil 79 // End: 80