Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. #ifndef __MGTK_BUTTON_H
  2. #define __MGTK_BUTTON_H
  3.  
  4. #include<mgtk/widget.h>
  5. #include<mgtk/pen.h>
  6.  
  7. #define bs_Normal               0
  8. #define bs_DontDraw             1
  9.  
  10. class GTextButton;
  11.  
  12. class GButton: public GWidget
  13. {
  14.     friend class GTextButton;
  15. public:
  16.     GButton(GRect *,int flags,unsigned long color,int cmd);
  17.     virtual ~GButton(void);
  18.     virtual void HandleEvent(GEvent *);
  19.     virtual void DrawWidget();
  20.     virtual void ClickProc();
  21.     virtual void SetCommand(int);
  22. private:
  23.     int bId;
  24.     int bFlags;
  25.     int bCmd;
  26.     unsigned long bColor;
  27. };
  28.  
  29. class GRadioButton;
  30.  
  31. class GCheckBox: public GWidget
  32. {
  33.     friend class GRadioButton;
  34. public:
  35.     GCheckBox(GRect *,bool);
  36.     virtual ~GCheckBox();
  37.     virtual void DrawWidget();
  38.     virtual void HandleEvent(GEvent *);
  39.     bool Checked();
  40.     void Check(bool);
  41. private:
  42.     bool state;
  43. };
  44.  
  45. class GRadioButton: public GCheckBox
  46. {
  47. public:
  48.     GRadioButton(GRect *,bool);
  49.     virtual ~GRadioButton();
  50.     virtual void DrawWidget();
  51. };
  52.  
  53. class GRadioGroup: public GGroup
  54. {
  55. public:
  56.  GRadioGroup(GRect *,int);
  57.  virtual ~GRadioGroup();
  58.  virtual void HandleEvent(GEvent *);
  59.  virtual int ActualButton();
  60. private:
  61.  int actual;
  62.  GRadioButton * _current_click;
  63. };
  64.  
  65. class GTextButton: public GButton
  66. {
  67. public:
  68.  GTextButton(GRect *,char *,int);
  69.  virtual ~GTextButton();
  70.  virtual void DrawWidget();
  71. private:
  72.  char * txt;
  73. };
  74.  
  75. class GButtonAllocator
  76. {
  77. public:
  78.  GButtonAllocator(int max);
  79.  virtual ~GButtonAllocator();
  80.  int New();
  81.  void Del(int);
  82. private:
  83.  unsigned char * gbutton_bitmap;
  84.  int nr_buttons;
  85. };
  86.  
  87. extern GButtonAllocator * OSButtonAlloc;
  88.  
  89. class GImageButton: public GButton
  90. {
  91. public:
  92.  GImageButton(GRect *,struct GImageData *,int);
  93.  virtual ~GImageButton();
  94.  virtual void DrawWidget();
  95. private:
  96.  struct GImageData * data;
  97. };
  98.  
  99. #endif
  100.