Initial Commit
This commit is contained in:
106
common/Dwindow.hpp
Normal file
106
common/Dwindow.hpp
Normal file
@@ -0,0 +1,106 @@
|
||||
#ifndef _COMMON_DWINDOW_HPP_
|
||||
#define _COMMON_DWINDOW_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_SMARTPOINTER_HPP_
|
||||
#include <common/pointer.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_GUIWINDOW_HPP_
|
||||
#include <common/guiwnd.hpp>
|
||||
#endif
|
||||
|
||||
class Rect;
|
||||
class String;
|
||||
|
||||
class DWindow : public GUIWindow
|
||||
{
|
||||
public:
|
||||
DWindow(void);
|
||||
virtual ~DWindow();
|
||||
bool createDialogParam(GUIWindow &frameWindow,GUIWindow &parentWindow,const String &strTemplate,LPARAM param);
|
||||
bool createDialogParam(GUIWindow &parentWindow,const String &strTemplate,LPARAM param);
|
||||
HWND getItem(int controlID)const;
|
||||
LRESULT sendMessage(DWORD controlID,UINT message,WPARAM wParam,LPARAM lParam)const;
|
||||
LRESULT postMessage(DWORD controlID,UINT message,WPARAM wParam,LPARAM lParam)const;
|
||||
void setText(UINT controlID,const String &setText)const;
|
||||
WORD getText(UINT controlID,String &textString)const;
|
||||
String getText(UINT controlID)const;
|
||||
BOOL setInt(UINT controlID,int value)const;
|
||||
BOOL getInt(UINT controlID,int &value)const;
|
||||
WORD enable(UINT controlID,WORD isEnabled)const;
|
||||
void setFocus(UINT controlID)const;
|
||||
bool show(UINT controlID,int nCmdShow=SW_SHOW)const;
|
||||
protected:
|
||||
void endDialog(WORD returnCode);
|
||||
virtual int windowProcedure(HWND hWnd,WORD message,WPARAM wParam,LPARAM lParam);
|
||||
private:
|
||||
DWindow(const DWindow &someDWindow);
|
||||
DWindow &operator=(const DWindow &someDWindow);
|
||||
|
||||
SmartPointer<GUIWindow> mFrameWindow;
|
||||
};
|
||||
|
||||
inline
|
||||
DWindow::DWindow(void)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
DWindow::DWindow(const DWindow &someDWindow)
|
||||
: GUIWindow(someDWindow) // private implementation
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
DWindow &DWindow::operator=(const DWindow &someDWindow)
|
||||
{ // private implementation
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
HWND DWindow::getItem(int controlID)const
|
||||
{
|
||||
if(!isValid())return FALSE;
|
||||
return ::GetDlgItem(*this,controlID);
|
||||
}
|
||||
|
||||
inline
|
||||
void DWindow::setFocus(UINT controlID)const
|
||||
{
|
||||
::SetFocus(getItem(controlID));
|
||||
}
|
||||
|
||||
inline
|
||||
bool DWindow::show(UINT controlID,int nCmdShow)const
|
||||
{
|
||||
return ::ShowWindow(getItem(controlID),nCmdShow);
|
||||
}
|
||||
|
||||
inline
|
||||
LRESULT DWindow::sendMessage(DWORD controlID,UINT message,WPARAM wParam,LPARAM lParam)const
|
||||
{
|
||||
if(!isValid())return FALSE;
|
||||
return ::SendMessage(getItem(controlID),message,wParam,lParam);
|
||||
}
|
||||
|
||||
inline
|
||||
LRESULT DWindow::postMessage(DWORD controlID,UINT message,WPARAM wParam,LPARAM lParam)const
|
||||
{
|
||||
if(!isValid())return FALSE;
|
||||
return ::PostMessage(::GetDlgItem(*this,controlID),message,wParam,lParam);
|
||||
}
|
||||
|
||||
inline
|
||||
WORD DWindow::enable(UINT controlID,WORD isEnabled)const
|
||||
{
|
||||
return ::EnableWindow(::GetDlgItem(*this,controlID),isEnabled);
|
||||
}
|
||||
|
||||
inline
|
||||
void DWindow::endDialog(WORD returnCode)
|
||||
{
|
||||
if(isValid())::EndDialog((HWND)*this,returnCode);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user