Initial
This commit is contained in:
228
dialog/DLGTMPL.HPP
Normal file
228
dialog/DLGTMPL.HPP
Normal file
@@ -0,0 +1,228 @@
|
||||
#ifndef _DIALOG_DIALOGTEMPLATE_HPP_
|
||||
#define _DIALOG_DIALOGTEMPLATE_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_RECTANGLE_HPP_
|
||||
#include <common/rect.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_GLOBALDATA_HPP_
|
||||
#include <common/gdata.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_BLOCK_HPP_
|
||||
#include <common/block.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_STRING_HPP_
|
||||
#include <common/string.hpp>
|
||||
#endif
|
||||
#ifndef _DIALOG_DIALOGITEMTEMPLATE_HPP_
|
||||
#include <dialog/dlgitem.hpp>
|
||||
#endif
|
||||
|
||||
class DialogTemplate : private DLGTEMPLATE
|
||||
{
|
||||
public:
|
||||
DialogTemplate(void);
|
||||
DialogTemplate(const DialogTemplate &someDialogTemplate);
|
||||
~DialogTemplate();
|
||||
DialogTemplate &operator=(const DialogTemplate &someDialogTemplate);
|
||||
WORD operator==(const DialogTemplate &someDialogTemplate)const;
|
||||
operator DLGTEMPLATE *(void);
|
||||
DialogTemplate &operator+=(const DialogItemTemplate &someDialogItemTemplate);
|
||||
DWORD style(void)const;
|
||||
void style(DWORD style);
|
||||
DWORD extendedStyle(void)const;
|
||||
void extendedStyle(DWORD extendedStyle);
|
||||
Rect posRect(void)const;
|
||||
void posRect(const Rect &posRect);
|
||||
WORD itemCount(void)const;
|
||||
String className(void)const;
|
||||
void className(const String &className);
|
||||
String titleText(void)const;
|
||||
void titleText(const String &titleText);
|
||||
String typeFace(void)const;
|
||||
void typeFace(const String &typeFace);
|
||||
WORD pointSize(void)const;
|
||||
void pointSize(WORD pointSize);
|
||||
private:
|
||||
enum{MaxTemplateBytes=16384};
|
||||
void itemCount(WORD itemCount);
|
||||
BYTE *alignBoundary(BYTE *lpCharByte)const;
|
||||
BYTE *copyString(BYTE *lpCharByte,const String &someString)const;
|
||||
Block<DialogItemTemplate> mDlgItems;
|
||||
GlobalData<BYTE> mItemData;
|
||||
WORD mPointSize;
|
||||
String mClassName;
|
||||
String mTitleText;
|
||||
String mTypeFace;
|
||||
};
|
||||
|
||||
inline
|
||||
DialogTemplate::DialogTemplate(void)
|
||||
{
|
||||
style(0);
|
||||
extendedStyle(0);
|
||||
itemCount(0);
|
||||
posRect(Rect(0,0,0,0));
|
||||
pointSize(0);
|
||||
}
|
||||
|
||||
inline
|
||||
DialogTemplate::DialogTemplate(const DialogTemplate &someDialogTemplate)
|
||||
{
|
||||
pointSize(0);
|
||||
*this=someDialogTemplate;
|
||||
}
|
||||
|
||||
inline
|
||||
DialogTemplate::~DialogTemplate()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
DialogTemplate &DialogTemplate::operator=(const DialogTemplate &someDialogTemplate)
|
||||
{
|
||||
style(someDialogTemplate.style());
|
||||
extendedStyle(someDialogTemplate.extendedStyle());
|
||||
itemCount(someDialogTemplate.itemCount());
|
||||
className(someDialogTemplate.className());
|
||||
titleText(someDialogTemplate.titleText());
|
||||
posRect(someDialogTemplate.posRect());
|
||||
pointSize(someDialogTemplate.pointSize());
|
||||
typeFace(someDialogTemplate.typeFace());
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD DialogTemplate::operator==(const DialogTemplate &someDialogTemplate)const
|
||||
{
|
||||
return (style()==someDialogTemplate.style()&&
|
||||
extendedStyle()==someDialogTemplate.extendedStyle()&&
|
||||
itemCount()==someDialogTemplate.itemCount()&&
|
||||
className()==someDialogTemplate.className()&&
|
||||
titleText()==someDialogTemplate.titleText()&&
|
||||
posRect()==someDialogTemplate.posRect()&&
|
||||
pointSize()==someDialogTemplate.pointSize()&&
|
||||
typeFace()==someDialogTemplate.typeFace());
|
||||
}
|
||||
|
||||
inline
|
||||
DialogTemplate &DialogTemplate::operator+=(const DialogItemTemplate &someDialogItemTemplate)
|
||||
{
|
||||
mDlgItems.insert(&someDialogItemTemplate);
|
||||
itemCount(itemCount()+1);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
DWORD DialogTemplate::style(void)const
|
||||
{
|
||||
return DLGTEMPLATE::style;
|
||||
}
|
||||
|
||||
inline
|
||||
void DialogTemplate::style(DWORD style)
|
||||
{
|
||||
DLGTEMPLATE::style=style;
|
||||
}
|
||||
|
||||
inline
|
||||
DWORD DialogTemplate::extendedStyle(void)const
|
||||
{
|
||||
return DLGTEMPLATE::dwExtendedStyle;
|
||||
}
|
||||
|
||||
inline
|
||||
void DialogTemplate::extendedStyle(DWORD extendedStyle)
|
||||
{
|
||||
DLGTEMPLATE::dwExtendedStyle=extendedStyle;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD DialogTemplate::itemCount(void)const
|
||||
{
|
||||
return DLGTEMPLATE::cdit;
|
||||
}
|
||||
|
||||
inline
|
||||
void DialogTemplate::itemCount(WORD itemCount)
|
||||
{
|
||||
DLGTEMPLATE::cdit=itemCount;
|
||||
}
|
||||
|
||||
inline
|
||||
Rect DialogTemplate::posRect(void)const
|
||||
{
|
||||
return Rect(DLGTEMPLATE::x,DLGTEMPLATE::y,DLGTEMPLATE::cx,DLGTEMPLATE::cy);
|
||||
}
|
||||
|
||||
inline
|
||||
void DialogTemplate::posRect(const Rect &posRect)
|
||||
{
|
||||
DLGTEMPLATE::x=posRect.left();
|
||||
DLGTEMPLATE::y=posRect.top();
|
||||
DLGTEMPLATE::cx=posRect.right();
|
||||
DLGTEMPLATE::cy=posRect.bottom();
|
||||
}
|
||||
|
||||
inline
|
||||
String DialogTemplate::className(void)const
|
||||
{
|
||||
return mClassName;
|
||||
}
|
||||
|
||||
inline
|
||||
void DialogTemplate::className(const String &className)
|
||||
{
|
||||
mClassName=className;
|
||||
}
|
||||
|
||||
inline
|
||||
String DialogTemplate::titleText(void)const
|
||||
{
|
||||
return mTitleText;
|
||||
}
|
||||
|
||||
inline
|
||||
void DialogTemplate::titleText(const String &titleText)
|
||||
{
|
||||
mTitleText=titleText;
|
||||
}
|
||||
|
||||
inline
|
||||
String DialogTemplate::typeFace(void)const
|
||||
{
|
||||
return mTypeFace;
|
||||
}
|
||||
|
||||
inline
|
||||
void DialogTemplate::typeFace(const String &typeFace)
|
||||
{
|
||||
mTypeFace=typeFace;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD DialogTemplate::pointSize(void)const
|
||||
{
|
||||
return mPointSize;
|
||||
}
|
||||
|
||||
inline
|
||||
void DialogTemplate::pointSize(WORD pointSize)
|
||||
{
|
||||
mPointSize=pointSize;
|
||||
}
|
||||
|
||||
inline
|
||||
BYTE *DialogTemplate::alignBoundary(BYTE *lpCharByte)const
|
||||
{
|
||||
WORD *lpWORD=((WORD*)lpCharByte);
|
||||
ULONG align;
|
||||
|
||||
align=(ULONG)lpWORD;
|
||||
align+=3;
|
||||
align>>=2;
|
||||
align<<=2;
|
||||
return (BYTE*)align;
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user