win32: fix view registers tool

This commit is contained in:
zeromus 2009-12-07 20:55:39 +00:00
parent 09689d9865
commit b3ad503d49
2 changed files with 33 additions and 17 deletions

View File

@ -119,8 +119,29 @@ void UnregWndClass(string name)
// Base toolwindow class // Base toolwindow class
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
CToolWindow::CToolWindow(char* className, WNDPROC proc, char* title, int width, int height) CToolWindow::CToolWindow(char* _className, WNDPROC _proc, char* _title, int _width, int _height)
: hWnd(NULL) : hWnd(NULL)
, className(_className)
, proc((DLGPROC)_proc)
, title(_title)
, width(_width)
, height(_height)
, whichInit(0)
{
}
CToolWindow::CToolWindow(int _ID, DLGPROC _proc, char* _title)
: hWnd(NULL)
, ID(_ID)
, proc(_proc)
, title(_title)
, whichInit(1)
{
}
void CToolWindow::PostInitialize()
{
if(whichInit==0)
{ {
DWORD style = WS_CAPTION | WS_SYSMENU | WS_SIZEBOX | WS_MINIMIZEBOX | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; DWORD style = WS_CAPTION | WS_SYSMENU | WS_SIZEBOX | WS_MINIMIZEBOX | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
RECT rc; RECT rc;
@ -131,19 +152,10 @@ CToolWindow::CToolWindow(char* className, WNDPROC proc, char* title, int width,
rc.bottom = height; rc.bottom = height;
AdjustWindowRect(&rc, style, FALSE); AdjustWindowRect(&rc, style, FALSE);
hWnd = CreateWindow(className, title, style, CW_USEDEFAULT, CW_USEDEFAULT, hWnd = CreateWindow(className, title.c_str(), style, CW_USEDEFAULT, CW_USEDEFAULT,
rc.right - rc.left, rc.bottom - rc.top, HWND_DESKTOP, NULL, hAppInst, (LPVOID)this); rc.right - rc.left, rc.bottom - rc.top, HWND_DESKTOP, NULL, hAppInst, (LPVOID)this);
} }
else
CToolWindow::CToolWindow(int _ID, DLGPROC _proc, char* _title)
: hWnd(NULL)
, ID(_ID)
, proc(_proc)
, title(_title)
{
}
void CToolWindow::PostInitialize()
{ {
hWnd = CreateDialogParam(hAppInst, MAKEINTRESOURCE(ID), HWND_DESKTOP, proc, (LPARAM)this); hWnd = CreateDialogParam(hAppInst, MAKEINTRESOURCE(ID), HWND_DESKTOP, proc, (LPARAM)this);
if (hWnd == NULL) if (hWnd == NULL)
@ -152,6 +164,7 @@ void CToolWindow::PostInitialize()
SetWindowText(hWnd, title.c_str()); SetWindowText(hWnd, title.c_str());
SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(hAppInst, "ICONDESMUME")); SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(hAppInst, "ICONDESMUME"));
} }
}
CToolWindow::~CToolWindow() CToolWindow::~CToolWindow()
{ {

View File

@ -110,6 +110,9 @@ private:
int ID; int ID;
DLGPROC proc; DLGPROC proc;
std::string title; std::string title;
char* className;
int width, height;
int whichInit;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------