home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / df3os2.zip / PBUTTON.H < prev    next >
C/C++ Source or Header  |  1993-09-23  |  2KB  |  73 lines

  1. // ----------- pbutton.h
  2.  
  3. #ifndef PBUTTON_H
  4. #define PBUTTON_H
  5.  
  6. #include "textbox.h"
  7.  
  8. class PushButton : public TextBox    {
  9.     DFWindow *owner;  // window that gets the command
  10.     void (DFWindow::*cmdfunction)();    // selection function
  11. protected:
  12.     Bool pressed;
  13. public:
  14.     PushButton(const char *lbl, int lf, int tp, DFWindow *par=0);
  15.     // -------- API messages
  16.     virtual Bool SetFocus();
  17.     virtual void ResetFocus();
  18.     virtual void Paint();
  19.     virtual void Shadow();
  20.     virtual void Keyboard(int key);
  21.     virtual void LeftButton(int mx, int my);
  22.     virtual void ButtonReleased(int mx, int my);
  23.     virtual void MouseMoved(int mx, int my);
  24.     virtual void KeyReleased();
  25.     virtual void PressButton();
  26.     virtual void ReleaseButton();
  27.     virtual void ButtonCommand();
  28.     virtual void ShortcutSelect();
  29.     void SetButtonFunction(DFWindow *wnd,
  30.                     void (DFWindow::*cmdfunc)())
  31.         { owner = wnd; cmdfunction = cmdfunc; }
  32. };
  33.  
  34. class OKButton : public PushButton    {
  35. public:
  36.     OKButton(int x, int y, DFWindow *par=0) :
  37.                     PushButton("  ~Ok  ", x, y, par)
  38.         { SetButtonFunction(par,
  39.                 &DFWindow::OKFunction); }
  40. };
  41.  
  42. class CancelButton : public PushButton    {
  43. public:
  44.     CancelButton(int x, int y, DFWindow *par=0) :
  45.                     PushButton("~Cancel", x, y, par)
  46.         { SetButtonFunction(par, &DFWindow::CancelFunction); }
  47. };
  48.  
  49. class YesButton : public PushButton    {
  50. public:
  51.     YesButton(int x, int y, DFWindow *par=0) :
  52.                     PushButton(" ~Yes ", x, y, par)
  53.         { SetButtonFunction(par, &DFWindow::OKFunction); }
  54. };
  55.  
  56. class NoButton : public PushButton    {
  57. public:
  58.     NoButton(int x, int y, DFWindow *par=0) :
  59.                     PushButton(" ~No  ", x, y, par)
  60.         { SetButtonFunction(par, &DFWindow::CancelFunction); }
  61. };
  62.  
  63. class HelpButton : public PushButton    {
  64. public:
  65.     HelpButton(int x, int y, DFWindow *par=0) :
  66.                     PushButton(" ~Help ", x, y, par)
  67.         { SetButtonFunction(par, &DFWindow::HelpFunction); }
  68. };
  69.  
  70. #endif
  71.  
  72.  
  73.