home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / dialog / tabdlg3 / src / internal.h next >
Encoding:
C/C++ Source or Header  |  1994-12-21  |  5.9 KB  |  155 lines

  1. ///////////////////////////////////////////////////////////////////////////
  2. // TabDlg Version 3.0
  3. // Copyright (c) 1994 Edward McCreary.
  4. // All rights reserved.
  5. //
  6. // Redistribution and use in source and binary forms are freely permitted
  7. // provided that the above copyright notice and attibution and date of work
  8. // and this paragraph are duplicated in all such forms.
  9. // THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
  10. // IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  11. // WARRANTIES OF MERCHANTIBILILTY AND FITNESS FOR A PARTICULAR PURPOSE.
  12. ///////////////////////////////////////////////////////////////////////////
  13. // File:    internal.h
  14. // Author:  Ed McCreary
  15. // Date:    11/7/94
  16. // Purpose: defines structures and constants internal to library
  17. ///////////////////////////////////////////////////////////////////////////
  18. #ifndef _INTERNAL_H
  19. #define _INTERNAL_H
  20.  
  21. // class style
  22. #define TAB_CLASS    CS_GLOBALCLASS | CS_HREDRAW | CS_VREDRAW
  23.  
  24. // fudge factor for end of tab
  25. #define WIDTH_FUDGE 5
  26.  
  27. // internal structures
  28.  
  29. // one control in a tab
  30. typedef struct tagTabChildControl
  31. {
  32.     WORD    wID;                        // control id
  33.     struct tagTabChildControl *next;    // next in linked list of controls
  34. } TABCHILDCTL, FAR *LPTABCHILDCTL;
  35.  
  36.  
  37. // single tab page
  38. typedef struct tagTabPage
  39. {
  40.     char    *szCaption;                 // caption of tab
  41.     RECT    rcTab;                      // tab rectangle    
  42.     RECT    rcCaption;                  // caption of rectangle
  43.     
  44.     WORD    wIndex;                     // index of tab    
  45.     LPTABCHILDCTL   lpControls;         // linked list of controls in tab
  46.     
  47.     struct tagTabPage   *next;          // next in linked list of tab pages
  48.     struct tagTabPage   *prev;          // previous in linked list of tab pages
  49.  
  50. }   TABPAGE, FAR *LPTABPAGE;
  51.  
  52.  
  53.  
  54. // one per tab control
  55. typedef struct tagTabControlBlock
  56. {
  57.     HWND        hWnd;                       // window handle of main control    
  58.     WORD        wNumTabs;                   // number of tabs in control
  59.     WORD        wStaticCount;               // count of controls with -1 id
  60.     
  61.     LPTABPAGE   pActiveTab;                 // pointer to currently active tab
  62.     WORD        wTabHeight;                 // height of tab in pixels    
  63.     LPTABPAGE   lpHead;                     // head of linked list of tab pages 
  64.     LPTABPAGE   lpTail;                     // tail of linked list of tab pages
  65.     BOOL        bShadow;                    // true if draw shadow text for caption
  66.  
  67. } TABCTLBLK, FAR *LPTABCTLBLK;
  68.  
  69.  
  70. // window word bytes
  71. #define CBWNDEXTRA  8   // number of required extra fonts
  72. #define GWW_DATA    0   // offset to data info
  73. #define GWW_FONT    2   // offset to active font data
  74. #define GWW_DEPRESSEDFONT   4  // ofset to depressed font data
  75. #define GWW_TABWIDTH   6          // offset to width of tab data
  76.  
  77. // index into pen arrays
  78. #define PEN_BLACK   0
  79. #define PEN_WHITE   1
  80. #define PEN_SHADOW  2
  81.  
  82. // structs used for manipulating dialog templates
  83. typedef struct {
  84.    long dtStyle;
  85.    BYTE dtItemCount;
  86.    int  dtX;
  87.    int  dtY;
  88.    int  dtCX;
  89.    int  dtCY;
  90. // char dtMenuName[];      // Variable-length string.
  91. // char dtClassName[];     // Variable-length string.
  92. // char dtCaptionText[];   // Variable-length string.
  93. } DLGTEMPLATE, FAR *LPDLGTEMPLATE;
  94.  
  95. typedef struct {
  96.    short int PointSize;
  97. // char  szTypeFace[];     // Variable-length string.
  98. } FONTINFO, FAR *LPFONTINFO;
  99.  
  100. typedef struct {
  101.    int  dtilX;
  102.    int  dtilY;
  103.    int  dtilCX;
  104.    int  dtilCY;
  105.    int  dtilID;
  106.    long dtilStyle;
  107. // char dtilClass[];       // Variable-length string.
  108. // char dtilText[];        // Variable-length string.
  109. // BYTE dtilInfo;          // # bytes in following memory block.
  110. // BYTE dtilData;          // Variable-length memory block.
  111. } DLGITEMTEMPLATE, FAR *LPDLGITEMTEMPLATE;
  112.  
  113.  
  114. #define PREDEFINEDCNTRLBIT       0x80
  115. #define BUTTONCNTRLCODE          0x80
  116. #define EDITCNTRLCODE            0x81
  117. #define STATICCNTRLCODE          0x82
  118. #define LISTBOXCNTRLCODE         0x83
  119. #define SCROLLBARCNTRLCODE       0x84
  120. #define COMBOBOXCNTRLCODE        0x85
  121.  
  122.  
  123. // local prototypes
  124. BOOL WINAPI TabControlInit(void);
  125. void WINAPI TabControlExit(void);
  126. LRESULT WINAPI TabDlgWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  127. void WINAPI DrawRoundBorder(HDC hdc, LPRECT lprc, LPTABCTLBLK pData, HPEN *pPens);
  128. WORD WINAPI CalcTabHeight(HWND hWnd);
  129. HFONT WINAPI GetDepressedTabFont(void);
  130. HFONT WINAPI GetActiveTabFont(HWND hWnd);
  131. LRESULT WINAPI OnNCCreate(HWND hWnd, CREATESTRUCT FAR *lpcs);
  132. LRESULT WINAPI OnPaint(LPTABCTLBLK pData);
  133.  
  134. LRESULT WINAPI OnAddTab(LPTABCTLBLK pData, WPARAM wParam, LPARAM lParam);
  135. int WINAPI CreateNewTab(LPTABCTLBLK pData,LPDLGTEMPLATE lpDlgTemplate);
  136.  
  137. BOOL WINAPI AppendControlToTab(LPTABPAGE pTab, WORD nID);
  138. BOOL WINAPI CreateTabControls(LPTABCTLBLK pData, LPTABPAGE pTab, LPDLGTEMPLATE lpDlgTemplate);
  139. void WINAPI FreeTab(LPTABPAGE pTab);
  140. LRESULT WINAPI OnNCDestroy(LPTABCTLBLK pData); 
  141. LPTABPAGE WINAPI GetTabPtrByIndex(LPTABCTLBLK pData, WORD wIndex);
  142. LRESULT WINAPI OnSetCurSel(LPTABCTLBLK pData, WORD wIndex);
  143. void WINAPI CalcTabRect(LPTABCTLBLK pData,LPTABPAGE  pTabPage);
  144. void WINAPI DrawUpTab(HDC hdc, LPTABCTLBLK pData,LPTABPAGE  pTabPage, HPEN *pPens);
  145. void WINAPI DrawDownTab(HDC hdc, LPTABCTLBLK pData,LPTABPAGE  pTabPage, HPEN *pPens);
  146. LRESULT OnLButtonDown(LPTABCTLBLK pData, POINT  *lpPt);
  147. void WINAPI DrawTabText(HDC hdc, LPTABCTLBLK pData,LPTABPAGE  pTabPage);
  148. LRESULT WINAPI NotifyParent(HWND hWndControl, WORD wNotifyCode) ;
  149. LRESULT WINAPI OnDeleteTab(LPTABCTLBLK pData,WORD wIndex);                    
  150. LRESULT WINAPI OnFindTab(LPTABCTLBLK pData,LPCSTR lpBuffer);
  151. LRESULT WINAPI OnGetTextLength(LPTABCTLBLK pData,WORD wIndex);
  152. LRESULT WINAPI OnGetText(LPTABCTLBLK pData,WORD wIndex,LPSTR lpBuffer);
  153. LPTABPAGE GetTabByIndex(LPTABCTLBLK pData,WORD wIndex);
  154. WORD CalcTabWidth(LPTABCTLBLK pData);
  155. #endif /* _INTERNAL_H */