1 /* 2 ****************************************************************** 3 ****************************************************************** 4 ******* ******** 5 ****** (C) 1988-2010 Tecplot, Inc. ******* 6 ******* ******** 7 ****************************************************************** 8 ****************************************************************** 9 */ 10 #ifndef _W__BASE_h 11 #define _W__BASE_h 12 13 #if defined TECPLOTKERNEL 14 15 #include "C__BASE.h" 16 17 typedef ULONG_PTR Widget; 18 #define NULLWIDGET ((unsigned long)0) 19 20 extern BOOL MSWinIsLargeFont; 21 extern CWnd *(TPClassArray[TPNUMCLASSES]); 22 23 typedef struct 24 { 25 CRect Rect; 26 BOOL RectSet; 27 CRect MinRect; // Only used for resizable dialogs 28 BOOL MinRectSet; // Only used for resizable dialogs 29 } TPDialogRect_s; 30 31 extern TPDialogRect_s TPDialogRect[TPNUMCLASSES]; 32 33 #define WindowIsResizable(wnd) ((wnd)->GetStyle() & WS_THICKFRAME) 34 35 /* 36 * NOTE: C = class number in TPClassArray (see C__BASE.h) 37 * 0=no class 38 * 1=TPMAINWND 39 * O = offset within container 40 * 0 means the container itself 41 * any other number is the offset within control (starting at 1) 42 * I = control number/id 43 * 0 = class itself 44 * for bitmap button groups, this is the container id 45 * for all other controls, this is the control id 46 * WidgetValue 0 is the NULL widget. 47 */ 48 49 //#define MAKEWIDGET(C,I,O) ((Widget)((((C)&0xFFFF)<<16)|(((O)&0xFF)<<8)|((I)&0xFF))) 50 51 #define CLASS_NUM_BITS 10 52 #define ITEM_ID_BITS 16 /* must be at least 16-bits to fit in the workarea */ 53 #define ITEM_OFFSET_BITS 6 54 55 /* The FILTER is also the maximum value. */ 56 #define CLASS_NUM_FILTER ((1<<CLASS_NUM_BITS)-1) 57 #define ITEM_ID_FILTER ((1<<ITEM_ID_BITS)-1) 58 #define ITEM_OFFSET_FILTER ((1<<ITEM_OFFSET_BITS)-1) 59 60 #define TP_CLASS_NO_CLASS 0 61 #define TP_ITEM_CLASS_ITSELF 0 62 #define TP_OFFSET_ITEM_ITSELF 0 63 64 #define TP_OFFSET_MENU_CASCADE (ITEM_OFFSET_FILTER-1) 65 #define TP_OFFSET_MENU_OPTION ITEM_OFFSET_FILTER 66 67 /* MAKEWIDGET must be a define and not an inline function so widget's can be used in case statements. */ 68 #define MAKEWIDGET(ClassNum, ItemID, ItemOffset) ((Widget)( ( ( ((ClassNum)<<ITEM_ID_BITS) | (ItemID) ) << ITEM_OFFSET_BITS ) | (ItemOffset) )) 69 GetClassNum(Widget W)70inline INT_PTR GetClassNum(Widget W) 71 { 72 return (W >> ITEM_ID_BITS) >> ITEM_OFFSET_BITS; 73 } GetItemID(Widget W)74inline INT_PTR GetItemID(Widget W) 75 { 76 return (W >> ITEM_OFFSET_BITS) & ITEM_ID_FILTER; 77 } GetItemOffset(Widget W)78inline INT_PTR GetItemOffset(Widget W) 79 { 80 return W & ITEM_OFFSET_FILTER; 81 } 82 83 /* 84 * We cannot use Boolean_t here because it is not defined yet. 85 */ 86 extern CWnd *GetWindowFromWidget(Widget); 87 extern CWnd *GetParentWndFromWidget(Widget); 88 extern Widget GetWidgetFromWindow(CWnd *); 89 extern BOOL WidgetExists(Widget W); 90 extern BOOL TPEnableDialog(CWnd *wnd, 91 BOOL bEnable); 92 extern void TPEnableAllDialogs(BOOL bEnable); 93 extern TPDialogRect_s* GetDialogRectFromWidget(Widget); 94 extern TPDialogRect_s* GetDialogRectFromWindow(CWnd* pWnd); 95 96 97 #endif /* TECPLOTKERNEL */ 98 99 /* 100 * This is the start of the translated string ID's 101 * in the resource file 102 */ 103 #define TP_TRANSLATED_STRING_START_ID 20000 104 105 #endif 106