bsp
|
00001 #ifndef _WCONTROL_H_ 00002 #define _WCONTROL_H_ 00003 00004 // 00005 // WControl 00006 // 00007 class WControl 00008 { 00009 public: 00010 HWND hwnd; 00011 WNDCLASSEX wc; 00012 WNDATTR attr; 00013 char caption[256]; 00014 00015 protected: 00016 bool created; 00017 00018 //methods 00019 public: 00020 //constructors 00021 WControl(HWND parent,int id,char * text,int cx,int cy, int width,int height); //createwindow 00022 WControl(HWND parentdlg, int id, bool subclass = false); // dialogs 00023 virtual ~WControl(); 00024 00025 static LRESULT CALLBACK MsgRouter(HWND hwnd, UINT msg,WPARAM wParam,LPARAM lParam); 00026 virtual LRESULT WndProc(UINT msg,WPARAM wParam,LPARAM lParam); 00027 WNDPROC oldwndproc; 00028 00029 bool Create(); 00030 00031 LRESULT SendMessage(UINT msg,WPARAM wParam,LPARAM lParam); 00032 00033 void SetCaption(char *caption); 00034 void SetFont(HFONT font,int redraw=0); 00035 }; 00036 00037 00038 00039 // 00040 // WEdit 00041 // 00042 class WEdit : public WControl 00043 { 00044 public: 00045 WEdit(HWND parent,int id,char *text,int cx,int cy, int width,int height,int textLimit=0, bool multiline=false); 00046 WEdit(HWND parentdlg, int id,const char *text=0, int textLimit=0, bool subclass=false); 00047 int GetText(char *lpString, int textLimit=-1); // if <0, use MaxLen from constructor 00048 void SetText(const char *str); 00049 void SetMaxText(int maxlen); 00050 void SetInt(int val); 00051 int GetInt(); 00052 void SetFloat(float val); 00053 float GetFloat(); 00054 int MaxLen; 00055 }; 00056 00057 // 00058 // WStatic 00059 // 00060 class WStatic : public WControl 00061 { 00062 public: 00063 WStatic(HWND parent,int id,char * text,int cx,int cy, int width,int height); 00064 WStatic(HWND parentdlg, int id, bool subclass = false); 00065 void SetText(char *str); 00066 }; 00067 00068 // 00069 // WButton 00070 // 00071 class WButton : public WControl 00072 { 00073 public: 00074 WButton(HWND parent,int id,char * text,int cx,int cy, int width,int height); 00075 WButton(HWND parentdlg, int id,bool subclass = false); 00076 }; 00077 // 00078 // WCheck 00079 // 00080 class WCheck : public WButton 00081 { 00082 public: 00083 WCheck(HWND parent,int id,char * text,int cx,int cy, int width,int height); 00084 WCheck(HWND parentdlg, int id,int defValue=BST_UNCHECKED,bool subclass = false); 00085 int GetCheck(); 00086 void SetCheck(int checkstate); 00087 }; 00088 00089 // 00090 // WRadio 00091 // 00092 class WRadio : public WCheck 00093 { 00094 public: 00095 WRadio(HWND parent,int id,char * text,int cx,int cy, int width,int height); 00096 WRadio(HWND parentdlg, int id,int defValue=BST_UNCHECKED,bool subclass = false); 00097 }; 00098 00099 // 00100 // WList - ListBox 00101 // 00102 class WList : public WControl 00103 { 00104 public: 00105 WList(HWND parent,int id,int cx,int cy, int width,int height); 00106 WList(HWND parentdlg, int id, bool subclass = false); 00107 int AddString(char *str); 00108 void ClearList(); 00109 void InsertString(char *str, int index = -1); 00110 int GetString(char *str, int index); 00111 int GetSelIndex(); 00112 void SetSelIndex(int index); 00113 void DeleteString(int index); 00114 int GetCount(); 00115 int GetItemHeight(int index); 00116 int GetTopIndex(); 00117 DWORD GetItemData(int index); 00118 bool SetItemData(int index, DWORD data); 00119 }; 00120 00121 00122 // 00123 // WCombo - ComboBox 00124 // 00125 class WCombo : public WControl 00126 { 00127 public: 00128 WCombo(HWND parent,int id,int cx,int cy, int width ,int height, int textLimit=0); 00129 WCombo(HWND parentdlg, int id, int textLimit=0, bool subclass=false); 00130 void LimitText(int len); 00131 int SetEditSel(int start, int end); 00132 int SetSelString(const char *lpszSelect, int indexStart); 00133 void SetText(const char *str); 00134 int ClearList(); 00135 int InsertString(char *str, int index = -1); 00136 int GetText(char *lpString, int nMaxCount = -1); 00137 int FindString(char *lpszFind, int index = -1); 00138 int FindStringExact(char *lpszFind, int index = -1); 00139 int GetString(char *lpszBuffer, int index); 00140 int GetSelIndex(); 00141 int SetSelIndex(int index); 00142 int DeleteString(int index); 00143 int GetCount(); 00144 int GetItemHeight(int index); 00145 int GetTopIndex(); 00146 int ShowList(); 00147 int HideList(); 00148 int AddString(char *str); 00149 DWORD GetItemData(int index); 00150 00151 int MaxLen; 00152 }; 00153 00154 // 00155 // WListView 00156 // 00157 class WListView : public WControl 00158 { 00159 public: 00160 WListView(HWND parent,int id,int cx,int cy, int width,int height); 00161 00162 int AddColumn(const char *text, int width); 00163 int AddItem(const char *text); 00164 }; 00165 00166 00167 00168 00169 #endif //_WCONTROL_H_ 00170 00171