116 lines
2.8 KiB
C++
116 lines
2.8 KiB
C++
#ifndef _COMMON_CONTROL_HPP_
|
|
#define _COMMON_CONTROL_HPP_
|
|
#ifndef _COMMON_WINDOWS_HPP_
|
|
#include <common/windows.hpp>
|
|
#endif
|
|
#ifndef _COMMON_WINDOW_HPP_
|
|
#include <common/window.hpp>
|
|
#endif
|
|
#ifndef _COMMON_RECTANGLE_HPP_
|
|
#include <common/rect.hpp>
|
|
#endif
|
|
|
|
class Control : public Window
|
|
{
|
|
public:
|
|
Control(void);
|
|
Control(HWND hControlWnd,UINT controlID,BOOL destroyWindow=TRUE);
|
|
virtual ~Control();
|
|
BOOL operator==(const Control &someControl)const;
|
|
WORD width(void)const;
|
|
void width(WORD width);
|
|
WORD height(void)const;
|
|
void height(WORD height);
|
|
UINT controlID(void)const;
|
|
virtual HWND createControl(const String &className,const String &windowName,DWORD dwStyle,const Rect &initRect,HWND hParentWnd,int controlID);
|
|
virtual HWND createControl(DWORD extendedStyle,const String &className,const String &windowName,DWORD dwStyle,const Rect &initRect,HWND hParentWnd,int controlID);
|
|
virtual HWND createControl(const String &className,const String &windowName,DWORD dwStyle,const Rect &initRect,Window &parentWindow,int controlID);
|
|
virtual HWND createControl(DWORD extendedStyle,const String &className,const String &windowName,DWORD dwStyle,const Rect &initRect,Window &parentWindow,int controlID);
|
|
virtual HWND assumeControl(HWND hControlWnd,UINT controlID,BOOL destroyWindow=FALSE);
|
|
private:
|
|
Control(const Control &someControl);
|
|
Control &operator=(const GUIWindow &someGUIWindow);
|
|
Control &operator=(const Control &someControl);
|
|
void controlID(UINT controlID);
|
|
UINT mControlID;
|
|
};
|
|
|
|
inline
|
|
Control::Control(void)
|
|
{
|
|
}
|
|
|
|
inline
|
|
Control::Control(HWND hControlWnd,UINT controlID,BOOL destroyWindow)
|
|
{
|
|
assumeControl(hControlWnd,controlID,destroyWindow);
|
|
}
|
|
|
|
inline
|
|
Control::Control(const Control &someControl)
|
|
{ // private implementation
|
|
}
|
|
|
|
inline
|
|
BOOL Control::operator==(const Control &someControl)const
|
|
{
|
|
return ((HWND)*this==(HWND)someControl);
|
|
}
|
|
|
|
inline
|
|
Control &Control::operator=(const Control &someControl)
|
|
{ // private implementation
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
Control &Control::operator=(const GUIWindow &someGUIWindow)
|
|
{ // private implementation
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
UINT Control::controlID(void)const
|
|
{
|
|
return mControlID;
|
|
}
|
|
|
|
inline
|
|
void Control::controlID(UINT controlID)
|
|
{
|
|
mControlID=controlID;
|
|
}
|
|
|
|
inline
|
|
WORD Control::width(void)const
|
|
{
|
|
Rect winRect;
|
|
windowRect(winRect);
|
|
return winRect.right()-winRect.left();
|
|
}
|
|
|
|
inline
|
|
void Control::width(WORD width)
|
|
{
|
|
Rect winRect;
|
|
windowRect(winRect);
|
|
::SetWindowPos(*this,HWND_BOTTOM,0,0,width,winRect.bottom()-winRect.top(),SWP_NOMOVE|SWP_NOZORDER);
|
|
}
|
|
|
|
inline
|
|
WORD Control::height(void)const
|
|
{
|
|
Rect winRect;
|
|
windowRect(winRect);
|
|
return winRect.bottom()-winRect.top();
|
|
}
|
|
|
|
inline
|
|
void Control::height(WORD height)
|
|
{
|
|
Rect winRect;
|
|
windowRect(winRect);
|
|
::SetWindowPos(*this,HWND_BOTTOM,0,0,winRect.right()-winRect.left(),height,SWP_NOMOVE|SWP_NOZORDER);
|
|
}
|
|
#endif
|