1 /********************************************************************
2 * Module: winui.h. This is part of WinUI.
4 * License: WinUI is covered by GNU General Public License,
5 * Copyright (C) 2001 Manu B.
6 * See license.htm for more details.
8 ********************************************************************/
12 /* These are patched headers */
23 #define SPLSTYLE_HORZ 0
24 #define SPLSTYLE_VERT 1
28 char *StpCpy(char *dest
, const char *src
);
29 size_t strcpylen(char *dest
, const char *src
);
31 void SplitFileName(char * dirName
, char * fileName
);
32 bool ChangeFileExt(char * fileName
, char * ext
);
40 void SetParent(HWND hwnd
);
41 void SetCaption(char * string
);
42 void DisplayString(char * string
, char * substring
= NULL
, UINT uType
= MB_OK
);
43 void DisplayWarning(char * string
, char * substring
= NULL
);
44 void DisplayFatal(char * string
, char * substring
= NULL
);
45 void DisplayLong(long number
);
46 void DisplayRect(RECT
* rect
);
47 int Ask(char * question
, bool canCancel
);
48 int AskToSave(bool canCancel
);
64 bool ChangeDirectory(char * dir
);
69 char pathBuf
[MAX_PATH
];
78 virtual HWND
CreateEx(CWindow
* pWindow
, DWORD dwExStyle
,
79 LPCTSTR lpClassName
, LPCTSTR lpWindowName
, DWORD dwStyle
, int x
, int y
,
80 int nWidth
, int nHeight
, HMENU hMenu
, LPVOID lpParam
);
83 LONG
SetLong(int nIndex
, LONG dwNewLong
);
84 LONG
GetLong(int nIndex
);
85 LRESULT
SendMessage(UINT msg
, WPARAM wParam
= 0, LPARAM lParam
= 0);
87 virtual bool SetPosition(HWND hInsertAfter
, int x
, int y
, int width
, int height
, UINT uFlags
);
88 virtual bool Show(int nCmdShow
= SW_SHOWNORMAL
);
89 virtual bool Hide(void);
101 class CWinBase
: public CWindow
115 bool Init(HINSTANCE hInstance
, HINSTANCE hPrevInstance
, LPSTR lpCmdLine
,
117 bool SetName(char * name
, char * version
= NULL
);
118 void ParseCmdLine(char * outBuff
);
121 bool ChangeDirectory(char * dir
);
128 class CSDIBase
: public CWinBase
134 virtual int Run(HINSTANCE hInstance
, HINSTANCE hPrevInstance
, LPSTR lpCmdLine
, int nCmdShow
);
135 virtual bool CustomInit(void);
136 virtual bool Release(void);
137 virtual bool CreateUI(void);
138 bool MainRegisterEx(const char * className
);
139 virtual LRESULT CALLBACK
CMainWndProc(UINT Message
, WPARAM wParam
, LPARAM lParam
);
151 class CMDIClient
: public CWindow
157 void Init(int menuIndex
, UINT idFirstChild
);
158 HWND
CreateEx(CWindow
* pWindow
, DWORD dwExStyle
, DWORD dwStyle
= WS_CHILD
, UINT resId
= 0);
159 LPARAM
GetParam(LPARAM lParam
);
166 CLIENTCREATESTRUCT ccs
;
175 UseOle(){oleError
= OleInitialize(NULL
);}
176 ~UseOle(){OleUninitialize();}
177 HRESULT
GetError(void){return oleError
;}
183 class CMDIBase
: public CSDIBase
189 virtual int Run(HINSTANCE hInstance
, HINSTANCE hPrevInstance
, LPSTR lpCmdLine
, int nCmdShow
);
190 virtual bool CustomInit(void);
191 virtual bool Release(void);
192 virtual bool CreateUI(void);
193 bool ChildRegisterEx(const char * className
);
194 virtual LRESULT CALLBACK
CMainWndProc(UINT Message
, WPARAM wParam
, LPARAM lParam
);
195 virtual LRESULT CALLBACK
CChildWndProc(CWindow
* pWnd
, UINT Message
, WPARAM wParam
, LPARAM lParam
);
197 CMDIClient MdiClient
;
205 class CMDIChild
: public CNode
, public CWindow
209 virtual ~CMDIChild();
211 HWND
CreateEx(CMDIClient
* pMdiClient
, DWORD dwExStyle
, DWORD dwStyle
, char * caption
, UINT resId
= 0, LPVOID lParam
= NULL
);
220 class CFileDlgBase
: public CWindow
227 void SetData(char * filter
, char * defExt
, DWORD flags
);
228 void SetTitle(char * title
);
229 void SetFilterIndex(DWORD filterIndex
);
230 void SetFilter(char * filter
);
231 void SetDefExt(char * defExt
);
232 void SetFlags(DWORD flags
);
233 void SetInitialDir(char * lpstrInitialDir
);
235 WORD
GetFileOffset(void);
236 WORD
GetFileExtension(void);
237 WORD
GetNextFileOffset(void);
239 bool OpenFileName(CWindow
* pWindow
, char * pszFileName
, DWORD nMaxFile
);
240 bool SaveFileName(CWindow
* pWindow
, char * pszFileName
, DWORD nMaxFile
);
245 WORD nNextFileOffset
;
249 class CDlgBase
: public CWindow
255 HWND
Create(CWindow
* pWindow
, WORD wResId
, RECT
* Pos
, LPARAM lParam
);
256 int CreateModal(CWindow
* pWindow
, WORD wResId
, LPARAM lParam
);
257 HWND
CreateParam(CWindow
* pWindow
, WORD wResId
, LPARAM lParam
);
258 BOOL
EndDlg(int nResult
);
259 virtual LRESULT CALLBACK
CDlgProc(UINT Message
, WPARAM wParam
, LPARAM lParam
);
260 HWND
GetItem(int nIDDlgItem
);
261 BOOL
SetItemText(HWND hItem
, LPCTSTR lpString
);
262 UINT
GetItemText(HWND hItem
, LPTSTR lpString
, int nMaxCount
);
263 /* BOOL SetItemInt(HWND hItem, UINT uValue, BOOL bSigned);
264 UINT GetItemInt(HWND hItem, BOOL *lpTranslated, BOOL bSigned);
271 class CTabbedDlg
: public CDlgBase
275 virtual ~CTabbedDlg();
277 virtual void OnNotify(int idCtrl
, LPNMHDR notify
);
278 virtual void OnSelChanging(LPNMHDR notify
);
279 virtual void OnSelChange(LPNMHDR notify
);
280 virtual bool SetChildPosition(HWND hChild
);
283 LPARAM
GetParam(void);
291 class CToolBar
: public CWindow
297 HWND
CreateEx(CWindow
* pWindow
, DWORD dwExStyle
, DWORD dwStyle
= WS_CHILD
, UINT resId
= 0);
298 LRESULT
AddBitmap(UINT resId
, int nBmp
, HINSTANCE hInstance
= 0);
299 BOOL
AddButtons(TBBUTTON
* tbButtons
, UINT numButtons
);
312 HBITMAP
Load(CWindow
* pWindow
, LPCTSTR lpBitmapName
);
313 HBITMAP
Load(CWindow
* pWindow
, WORD wResId
);
329 HIMAGELIST
Create(int cx
, int cy
, UINT flags
, int cInitial
, int cGrow
);
330 int AddMasked(CBitmap
* pBitmap
, COLORREF crMask
);
331 HIMAGELIST
GetId(void){return hImgList
;};
339 class CTabCtrl
: public CWindow
345 HWND
CreateEx(CWindow
* pWindow
, DWORD dwExStyle
, DWORD dwStyle
= WS_CHILD
, UINT resId
= 0, LPVOID lParam
= NULL
);
346 BOOL
SetItem_Param(int iItem
, LPARAM lParam
);
347 LPARAM
GetItem_Param(int iItem
);
349 int InsertItem(int iItem
, UINT mask
, DWORD dwState
, DWORD dwStateMask
,
350 LPTSTR pszText
, int cchTextMax
, int iImage
, LPARAM lParam
);
358 class CTreeView
: public CWindow
366 HWND
CreateEx(CWindow
* pWindow
, DWORD dwExStyle
, DWORD dwStyle
= WS_CHILD
, UINT resId
= 0, LPVOID lParam
= NULL
);
367 HTREEITEM
CreateItem(HTREEITEM hParent
, HTREEITEM hInsertAfter
, int iImage
, LPTSTR pszText
, LPARAM lParam
);
368 LPARAM
GetSelectedItemParam(void);
374 class CScintilla
: public CWindow
380 HWND
CreateEx(CWindow
* pWindow
, DWORD dwExStyle
, DWORD dwStyle
= WS_CHILD
, UINT resId
= 0, LPVOID lParam
= NULL
);
386 class CListView
: public CWindow
392 HWND
CreateEx(CWindow
* pWindow
, DWORD dwExStyle
, DWORD dwStyle
= WS_CHILD
, UINT resId
= 0);
401 class CStatusBar
: public CWindow
407 HWND
CreateEx(CWindow
* pWindow
, DWORD dwExStyle
, DWORD dwStyle
= WS_CHILD
, UINT resId
= 0);
408 void SetParts(int nParts
, int * aWidths
);
410 void WriteString(char * string
, int part
);
411 void WriteLong(long number
, int part
);
419 class CSplitter
: public CWindow
425 void Init(CWindow
* pane1
, CWindow
* pane2
, bool vertical
,
426 int barPos
, int barMode
);
427 bool SetPosition(HWND hInsertAfter
, int x
, int y
, int width
, int height
, UINT uFlags
);
428 bool Show(int nCmdShow
= SW_SHOWNORMAL
);
430 bool HaveMouse(HWND hwnd
, short xPos
, short yPos
);
431 void Move(int mouseX
, int mouseY
);
432 bool OnLButtonDown(HWND hwnd
, short xPos
, short yPos
);
433 void OnMouseMove(HWND hwnd
, short xPos
, short yPos
);
434 void OnLButtonUp(HWND hwnd
, short xPos
, short yPos
);
435 bool OnSetCursor(HWND hwnd
, LPARAM lParam
);
438 void SetVertPosition(void);
439 void SetHorzPosition(void);
440 void DrawXorBar(HDC hdc
, int x1
, int y1
, int width
, int height
);
441 void ClientToWindow(HWND hwnd
, POINT
* pt
, RECT
* rect
);
462 #define MAX_BLOC_SIZE 16384
469 bool Load(char * fullPath
);
471 bool GetString(char * data
, char * key
, char * section
= NULL
);
472 int GetInt(char * key
, char * section
= NULL
);
482 bool FindSection(char * pcurrent
, char * section
);
483 bool FindData(char * s
, char * key
, char * data
);
484 long CopyData(char * data
, char * s
);
485 char *SkipUnwanted(char *s
);
508 bool BrowseForFolder(CWindow
* pWindow
, LPSTR pszDisplayName
, LPCSTR lpszTitle
,
509 UINT ulFlags
, BFFCALLBACK lpfn
=0, LPARAM lParam
=0, int iImage
=0);
518 class CCriticalSection