82 lines
1.8 KiB
C++
82 lines
1.8 KiB
C++
#ifndef _MDIWIN_HPP_
|
|
#define _MDIWIN_HPP_
|
|
#include <mdiwin/windows.hpp>
|
|
#include <mdiwin/windowsx.hpp>
|
|
#include <mdiwin/crsctrl.hpp>
|
|
|
|
class MDIWindow : public CursorControl
|
|
{
|
|
public:
|
|
MDIWindow();
|
|
virtual ~MDIWindow();
|
|
HWND GetHandle(void)const;
|
|
int Show(int nCmdShow)const;
|
|
void Update(void)const;
|
|
protected:
|
|
virtual long WndProc(UINT message,WPARAM wParam,LPARAM lParam)=0;
|
|
// static long FAR PASCAL _export MDIWndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
|
|
__declspec(dllexport) static LONG FAR PASCAL MDIWndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
|
|
private:
|
|
#if defined (__SMALL__) || defined (__MEDIUM__)
|
|
static MDIWindow *MDIWindow::GetPointer(HWND hWnd);
|
|
static void MDIWindow::SetPointer(HWND hWnd,MDIWindow *pWindow);
|
|
#else
|
|
static MDIWindow *MDIWindow::GetPointer(HWND hWnd);
|
|
static void MDIWindow::SetPointer(HWND hWnd,MDIWindow *pWindow);
|
|
#endif
|
|
void SetHandle(HWND hWnd);
|
|
HWND mhWnd;
|
|
};
|
|
|
|
inline
|
|
HWND MDIWindow::GetHandle(void)const
|
|
{
|
|
if(::IsWindow(mhWnd))return mhWnd;
|
|
return 0;
|
|
}
|
|
|
|
inline void MDIWindow::SetHandle(HWND hWnd)
|
|
{
|
|
mhWnd=hWnd;
|
|
}
|
|
|
|
inline
|
|
int MDIWindow::Show(int nCmdShow)const
|
|
{
|
|
if(!GetHandle())return FALSE;
|
|
return ::ShowWindow(GetHandle(),nCmdShow);
|
|
}
|
|
|
|
inline
|
|
void MDIWindow::Update(void)const
|
|
{
|
|
if(!GetHandle())return;
|
|
::UpdateWindow(GetHandle());
|
|
}
|
|
|
|
#if defined (__SMALL__) || defined (__MEDIUM__)
|
|
inline
|
|
MDIWindow *MDIWindow::GetPointer(HWND hWnd)
|
|
{
|
|
return (MDIWindow*)GetWindowWord(hWnd,0);
|
|
|
|
}
|
|
inline
|
|
void MDIWindow::SetPointer(HWND hWnd,MDIWindow *pWindow)
|
|
{
|
|
SetWindowWord(hWnd,0,(WORD)pWindow);
|
|
}
|
|
#else
|
|
inline
|
|
MDIWindow *MDIWindow::GetPointer(HWND hWnd)
|
|
{
|
|
return (MDIWindow*)::GetWindowLong(hWnd,0);
|
|
}
|
|
inline
|
|
void MDIWindow::SetPointer(HWND hWnd,MDIWindow *pWindow)
|
|
{
|
|
::SetWindowLong(hWnd,0,(LONG)pWindow);
|
|
}
|
|
#endif
|
|
#endif
|