home *** CD-ROM | disk | FTP | other *** search
/ Media Share 13 / mediashare_13.zip / mediashare_13 / ZIPPED / PROGRAM / TBIWIN12.ZIP / TBIWIN.H < prev    next >
C/C++ Source or Header  |  1992-12-15  |  4KB  |  122 lines

  1. //----------------------------------------------------
  2. // TBIWINDOW.H
  3. //----------------------------------------------------
  4. // TBIWindow Ver 1.2 (c) Copyright Casper Pedersen  1992
  5. // This source must be used, but not changed is it is
  6. // distributed to other people
  7. // If any questions write to
  8. // Casper Pedersen
  9. // P. Knudsensvej 14, 3, V. 11.
  10. // DK-8900  Randers
  11. // Denmark
  12. //
  13. // NOTE
  14. // The TBIWindow will might not work under Win30, that
  15. // is because I use WM_WINDOWPOSCHANGED, which first
  16. // was implemented in Win31.
  17. //----------------------------------------------------
  18. #ifndef TBIWINDOW_H
  19. #define TBIWINDOW_H
  20. //----------------------------------------------------
  21. #include <owl.h>
  22. //----------------------------------------------------
  23. // Defines
  24. //----------------------------------------------------
  25. typedef enum{LEFT, RIGHT}    LEFTRIGHT;
  26.  
  27.  
  28. // Version no. HIWORD is the major version, and LOWORD is the minor version
  29. #define TBIVERSION    0x00010002
  30.  
  31. //----------------------------------------------------
  32. // Simple structure used in a double linked list
  33. //----------------------------------------------------
  34. _CLASSDEF(TBIList)
  35. struct TBIList
  36. {
  37.    UINT        ButtonNo;
  38.    HBITMAP    ButtonDeactive;
  39.    HBITMAP    ButtonActive;
  40.  
  41.    PTBIList    next;
  42.    PTBIList    prev;
  43. };
  44.  
  45. //----------------------------------------------------
  46. // The actual class
  47. //----------------------------------------------------
  48. _CLASSDEF(TBIWindow)
  49. class _EXPORT TBIWindow : public TWindow
  50. {
  51.   private:
  52.     PTBIList    head;
  53.     PTBIList    tail;
  54.  
  55.     UINT    NoButtonsIn;    // How many buttons is in window
  56.     int     ActivatedButton;
  57.  
  58.     LPSTR    WinName;    // Caption name
  59.     BOOL    ButtonDown;    // is button down
  60.     POINT    AKTBut;        // where the button is pushed
  61.     RECT    AKTRect;
  62.  
  63.     UINT    XEnd;        // where to end the list
  64.     UINT    XStart;        // where to start the list
  65.  
  66.     BOOL    WinActive;
  67.     BOOL    WinHidden;
  68.  
  69.     LEFTRIGHT    _LR;        // Is Buttons Left or Rigth in Caption
  70.  
  71.     BOOL    IsInList(UINT ResId);
  72.  
  73.   protected:
  74.     void UpdateCaption(void);    // updates the caption
  75.  
  76.     UINT ButtonActive;        // whitch button is activated
  77.  
  78.     void DisplayButton(void);    // dispaly the list
  79.     void HighLiteButton(void);  // highligthes activated/deativated button
  80.     BOOL CalcRect(POINT pt);
  81.  
  82.     UINT CloseSize(void);       // Size of SystemMenu
  83.     UINT ButtonSize(void);      // Size of Minimize and Maximize buttons
  84.  
  85.     virtual LONG TBIGetVersion() { return TBIVERSION; }
  86.     virtual LPSTR GetClassName() { return ("TBIWindow"); }
  87.     virtual void AboutTBIWindow(void);
  88.  
  89.   public:
  90.     // constructor and destructor
  91.     TBIWindow(PTWindowsObject AParent, LPSTR ATitle, LEFTRIGHT LR = LEFT, PTModule AModule = NULL);
  92.     ~TBIWindow();
  93.  
  94.     virtual void GetWindowClass(WNDCLASS _FAR &AWndClass);
  95.  
  96.     // overloaded functions
  97.     virtual void WMNCLButtonDBLCLK(RTMessage Msg) = [WM_FIRST + WM_NCLBUTTONDBLCLK];
  98.     virtual void WMNCLButtonDown(RTMessage Msg)    = [WM_FIRST + WM_NCLBUTTONDOWN];
  99.     virtual void WMNCLButtonUp(RTMessage Msg)    = [WM_FIRST + WM_NCLBUTTONUP];
  100.     virtual void WMLButtonUp(RTMessage Msg)     = [WM_FIRST + WM_LBUTTONUP];
  101.     virtual void WMNCMouseMove(RTMessage Msg)    = [WM_FIRST + WM_NCMOUSEMOVE];
  102.     virtual void WMMouseMove(RTMessage Msg)    = [WM_FIRST + WM_MOUSEMOVE];
  103.  
  104.     virtual void WMActivate(RTMessage Msg)    = [WM_FIRST + WM_ACTIVATE];
  105.  
  106.     virtual void WMMove(RTMessage Msg)        = [WM_FIRST + WM_MOVE]    { TWindow::WMMove(Msg); UpdateCaption(); }
  107.     virtual void WMSize(RTMessage Msg)        = [WM_FIRST + WM_SIZE];
  108.  
  109.     virtual void WMWindowPosChanged(RTMessage)    = [WM_FIRST + WM_WINDOWPOSCHANGED];
  110.  
  111.     // insertes a button last in list
  112.     virtual BOOL AddButton(UINT ResourceID);
  113.  
  114.     // dummy function to use in parent
  115.     virtual void ButtonActivated(void);
  116. };
  117.  
  118.  
  119. //----------------------------------------------------
  120. #endif
  121. //----------------------------------------------------
  122.