6 #ifndef _INC_cWndControls_H
7 #define _INC_cWndControls_H
24 cWndStatic(cWndHandle* pWndParent,
DLGID_t id) : cWndHandle(pWndParent, id)
33 HICON SetIcon(HICON hIcon)
36 return (HICON)(UINT_PTR)SendMessageX(STM_SETICON, (WPARAM)hIcon);
41 return (HICON)(UINT_PTR)SendMessageX(STM_GETICON);
44 HENHMETAFILE SetEnhMetaFile(HENHMETAFILE hMetaFile)
47 return (HENHMETAFILE)(UINT_PTR)SendMessageX(STM_SETIMAGE, IMAGE_ENHMETAFILE, (LPARAM)hMetaFile);
49 HENHMETAFILE GetEnhMetaFileX()
const
52 return (HENHMETAFILE)(UINT_PTR)SendMessageX(STM_GETIMAGE, IMAGE_ENHMETAFILE);
56 HBITMAP SetBitmap(HBITMAP hBitmap)
59 return (HBITMAP)(UINT_PTR)SendMessageX(STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap);
61 HBITMAP GetBitmap()
const
64 return (HBITMAP)(UINT_PTR)SendMessageX(STM_GETIMAGE, IMAGE_BITMAP);
66 HCURSOR SetCursor(HCURSOR hCursor)
69 return (HCURSOR)(UINT_PTR)SendMessageX(STM_SETIMAGE, IMAGE_CURSOR, (LPARAM)hCursor);
74 return (HCURSOR)(UINT_PTR)SendMessageX(STM_GETIMAGE, IMAGE_CURSOR);
89 cWndEdit(cWndHandle* pWndParent,
DLGID_t id) : cWndHandle(pWndParent, id)
97 void SetSel(DWORD dwSelectionPos)
101 SendMessageX(EM_SETSEL, (WPARAM)dwSelectionPos, (LPARAM)dwSelectionPos);
106 SendMessageX(EM_SETSEL, (WPARAM)nStartChar, (LPARAM)nEndChar);
112 return((DWORD)SendMessageX(EM_GETSEL));
117 DWORD dwSel = GetSel();
118 nStartChar = LOWORD(dwSel);
119 nEndChar = HIWORD(dwSel);
122 void ReplaceSel(
const GChar_t* lpszNewText,
bool bCanUndo =
false)
125 SendMessageX(EM_REPLACESEL, (WPARAM)bCanUndo, (LPARAM)lpszNewText);
128 int GetLineCount()
const
131 return (
int)SendMessageX(EM_GETLINECOUNT);
133 int GetLine(
int nLine,
GChar_t* lpszBuffer)
const
137 return (
int)SendMessageX(EM_GETLINE, (WPARAM)nLine, (LPARAM)lpszBuffer);
142 return (
StrLen_t)SendMessageX(EM_LINELENGTH, (WPARAM)nCharIndex);
144 StrLen_t LineIndex(
int nLine = -1)
const
147 return (
int)SendMessageX(EM_LINEINDEX, (WPARAM)nLine);
149 int LineFromChar(
StrLen_t nCharIndex)
const
152 return (
int)(DWORD)SendMessageX(EM_LINEFROMCHAR, (WPARAM)(int)(nCharIndex), 0L);
155 BOOL GetModify()
const
157 return((BOOL)SendMessageX(EM_GETMODIFY));
159 void SetModify(
bool bModified)
161 SendMessageX(EM_SETMODIFY, (WPARAM)(UINT)(bModified));
164 DWORD Scroll(
int iAction = SB_PAGEDOWN)
166 return((DWORD)SendMessageX(EM_SCROLL, (WPARAM)iAction));
170 SendMessageX(EM_SCROLLCARET);
172 void ScrollLine(
int iLines = 0,
StrLen_t iChars = 0)
176 SendMessageX(EM_LINESCROLL, (WPARAM)iChars, (LPARAM)iLines);
178 void SetTabStops(
int cTabs,
const int* lpTabs)
180 SendMessageX(EM_SETTABSTOPS, (WPARAM)cTabs, (LPARAM)lpTabs);
184 BOOL CanUndo()
const { (BOOL)(DWORD)SendMessageX(EM_CANUNDO, 0L, 0L) }
185 BOOL Undo() { (BOOL)(DWORD)SendMessageX(EM_UNDO, 0L, 0L) }
186 void EmptyUndoBuffer() { (void)SendMessageX(EM_EMPTYUNDOBUFFER, 0L, 0L) }
187 void SetPasswordChar(ch) { (void)SendMessageX(EM_SETPASSWORDCHAR, (WPARAM)(UINT)(ch), 0L) }
188 BOOL FmtLines(fAddEOL) { (BOOL)(DWORD)SendMessageX(EM_FMTLINES, (WPARAM)(BOOL)(fAddEOL), 0L) }
192 HLOCAL get_Handle()
const
194 return((HLOCAL)(UINT_PTR)SendMessageX(EM_GETHANDLE));
196 void SetHandle(HLOCAL h)
198 SendMessageX(EM_SETHANDLE, (WPARAM)(HLOCAL)(h));
202 int GetFirstVisibleLine()
const
204 return((
int)SendMessageX(EM_GETFIRSTVISIBLELINE));
206 bool SetTextFromFile(
const FILECHAR_t* pszFilename);
217 cWndComboBox(cWndHandle* pWndParent,
DLGID_t id) : cWndHandle(pWndParent, id)
219 virtual ~cWndComboBox()
228 return (
int)SendMessageX(CB_GETCOUNT);
230 int GetCurSel()
const
233 return (
int)SendMessageX(CB_GETCURSEL, 0, 0);
235 int SetCurSel(
int nSelect)
238 return (
int)SendMessageX(CB_SETCURSEL, nSelect, 0);
242 DWORD GetEditSel()
const
245 return (DWORD)SendMessageX(CB_GETEDITSEL, 0, 0);
249 DWORD_PTR GetItemData(
int nIndex)
const
252 return (DWORD_PTR)SendMessageX(CB_GETITEMDATA, nIndex, 0);
254 int SetItemData(
int nIndex, DWORD_PTR dwItemData)
257 return (
int)SendMessageX(CB_SETITEMDATA, nIndex, (LPARAM)dwItemData);
264 int AddString(
const GChar_t* lpszString)
268 return (
int)SendMessageX(CB_ADDSTRING, 0, (LPARAM)lpszString);
270 int AddItem(
const GChar_t* lpszString, DWORD_PTR dwItemData)
272 int nIndex = AddString(lpszString);
273 SetItemData(nIndex, dwItemData);
276 int InsertString(
int nIndex,
const GChar_t* lpszString)
279 return (
int)SendMessageX(CB_INSERTSTRING, nIndex, (LPARAM)lpszString);
281 int InsertItem(
int nIndex,
const GChar_t* lpszString, DWORD_PTR dwItemData)
283 nIndex = InsertString(nIndex, lpszString);
284 SetItemData(nIndex, dwItemData);
288 int DeleteItem(UINT nIndex)
291 return (
int)SendMessageX(CB_DELETESTRING, nIndex, 0);
296 SendMessageX(CB_RESETCONTENT, 0, 0);
299 int GetLBTextLen(
int nIndex)
const
303 return (
int)SendMessageX(CB_GETLBTEXTLEN, nIndex, 0);
305 int GetLBText(
int nIndex,
GChar_t* lpszText)
const
309 return (
int)SendMessageX(CB_GETLBTEXT, nIndex, (LPARAM)lpszText);
311 int GetLBText(
int nIndex,
cString& rString)
const;
312 cString GetLBText(
int nIndex)
const;
315 int FindString(
int nStartAfter,
const GChar_t* lpszString)
const;
316 int SelectString(
int nStartAfter,
const GChar_t* lpszString);
330 cWndScrollBar(cWndHandle* pWndParent,
DLGID_t id) : cWndHandle(pWndParent, id)
332 virtual ~cWndScrollBar()
337 int GetScrollPos()
const
340 return ::GetScrollPos(get_Hwnd(), SB_CTL);
342 int SetScrollPos(
int nPos,
bool bRedraw)
345 return ::SetScrollPos(get_Hwnd(), SB_CTL, nPos, bRedraw);
347 void GetScrollRange(LPINT lpMinPos, LPINT lpMaxPos)
const
350 ::GetScrollRange(get_Hwnd(), SB_CTL, lpMinPos, lpMaxPos);
352 void SetScrollRange(
int nMinPos,
int nMaxPos,
bool bRedraw)
355 ::SetScrollRange(get_Hwnd(), SB_CTL, nMinPos, nMaxPos, bRedraw);
357 void ShowScrollBar(
bool bShow)
360 ::ShowScrollBar(get_Hwnd(), SB_CTL, bShow);
362 BOOL EnableScrollBar(UINT nArrowFlags)
365 return ::EnableScrollBar(get_Hwnd(), SB_CTL, nArrowFlags);
368 BOOL SetScrollInfo(LPSCROLLINFO lpScrollInfo,
bool bRedraw)
370 lpScrollInfo->cbSize =
sizeof(*lpScrollInfo);
371 ::SetScrollInfo(get_Hwnd(), SB_CTL, lpScrollInfo, bRedraw);
375 BOOL GetScrollInfo(LPSCROLLINFO lpScrollInfo, UINT nMask)
377 lpScrollInfo->cbSize =
sizeof(*lpScrollInfo);
378 lpScrollInfo->fMask = nMask;
379 return ::GetScrollInfo(get_Hwnd(), SB_CTL, lpScrollInfo);
385 GetScrollRange(&nMin, &nMax);
387 if (GetScrollInfo(&info, SIF_PAGE))
389 int iPage = info.nPage - 1;
407 cWndListBox(cWndHandle* pWndParent,
DLGID_t id) : cWndHandle(pWndParent, id)
409 virtual ~cWndListBox()
418 SendMessageX(LB_RESETCONTENT);
422 return((
int)(DWORD)SendMessageX(LB_GETCOUNT));
424 int AddString(
const GChar_t* lpsz)
const
426 return((
int)(DWORD)SendMessageX(LB_ADDSTRING, 0L, (LPARAM)(lpsz)));
428 int DeleteString(
int index)
430 return((
int)(DWORD)SendMessageX(LB_DELETESTRING, (WPARAM)(
index), 0L));
434 return((
int)(DWORD)SendMessageX(LB_INSERTSTRING, (WPARAM)(
index), (LPARAM)(lpsz)));
436 DWORD_PTR GetItemData(
int index)
const
438 return((DWORD_PTR)SendMessageX(LB_GETITEMDATA, (WPARAM)(
index), 0L));
442 return((
int)(DWORD)SendMessageX(LB_SETITEMDATA, (WPARAM)(
int)(
index), (LPARAM)(
data)));
444 int GetTextLen(
int index)
446 return((
int)(DWORD)SendMessageX(LB_GETTEXTLEN, (WPARAM)(
index)));
450 return((
int)(DWORD)SendMessageX(LB_GETTEXT, (WPARAM)(
index), (LPARAM)(lpszBuffer)));
452 int AddItemData(DWORD
data)
454 return((
int)(DWORD)SendMessageX(LB_ADDSTRING, 0L, (LPARAM)(
data)));
456 int InsertItemData(
int index, DWORD
data)
458 return((
int)(DWORD)SendMessageX(LB_INSERTSTRING, (WPARAM)(
index), (LPARAM)(
data)));
460 void SetTabStops(
int cTabs,
const int* lpTabs)
462 SendMessageX(LB_SETTABSTOPS, (WPARAM)(
int)(cTabs), (LPARAM)(
const int*)(lpTabs));
464 int SetCurSel(
int index)
466 return((
int)(DWORD)SendMessageX(LB_SETCURSEL, (WPARAM)
index));
468 int GetCurSel()
const
470 return((
int)(DWORD)SendMessageX(LB_SETCURSEL));
482 cWndButton(cWndHandle* pWndParent,
DLGID_t id) : cWndHandle(pWndParent, id)
484 virtual ~cWndButton()
492 return((
int)(DWORD)SendMessageX(BM_GETCHECK));
494 void SetCheck(
int check)
497 SendMessageX(BM_SETCHECK, (WPARAM)(check));
499 void SetCheckBool(
bool bCheck)
501 SetCheck(bCheck ? BST_CHECKED : BST_UNCHECKED);
506 return((
int)(DWORD)SendMessageX(BM_GETSTATE));
508 UINT SetState(
int state)
510 return((UINT)(DWORD)SendMessageX(BM_SETSTATE, (WPARAM)(state)));
515 typedef cWndStatic CStatic;
516 typedef cWndEdit CEdit;
517 typedef cWndComboBox CComboBox;
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
Using X files without the sources and the makefile How to use you just create a debug directory e the sample3 directory must contain Sample3 Final Sample3 exe Sample3 Final Debug Sample3 Final Gfx OpenGL bmp Sample3 Final Gfx tiny_skin bmp Sample3 Final Gfx tiny_4anim x The source files have the DevCpp project file plus the makefile The demos use standard FreeGlut functions Technical without warranty Neither Paul Coppens nor GameDev net make any or either express or with respect to the their or fitness for a specific purpose neither Paul Coppens nor GameDev net shall have any liability to you or any other person or entity with respect to any or damage caused or alleged to have been caused directly or indirectly by the programs provided by Paul Coppens and GameDev net This but is not limited interruption of loss of data
Definition: Readme.txt:39
#define ASSERT(exp)
Definition: cDebugAssert.h:87
#define WINHANDLE_NULL
HWND, HPEN, etc are NOT OS Handles. like HWND_DESKTOP. like HANDLEPTR_NULL. This is a WINAPI void* ha...
Definition: cOSHandle.h:23
UINT DLGID_t
old window format this was a WORD, EX format this is UINT32.
Definition: cResDialog.h:68
int StrLen_t
the length of a string in chars (bytes for UTF8, wchar_t for UNICODE). or offset in characters....
Definition: StrConst.h:32
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22
char GChar_t
My version of TCHAR, _TCHAR.
Definition: StrConst.h:26
cArrayString< char > cArrayStringA
Definition: cArrayString.h:174
cStringT< GChar_t > cString
Definition: cString.h:636
uint16 index
Definition: sample3.cpp:29