source: dev/trunk/ab5.0/abdev/abdev/include/ProjectManager/WindowManager.h@ 624

Last change on this file since 624 was 624, checked in by dai_9181, 16 years ago

WindowInfoクラスをリファクタリング

File size: 3.4 KB
RevLine 
[615]1#pragma once
2
3
[624]4namespace ActiveBasic{ namespace PM{
[615]5
[624]6
[615]7struct ImageReferenceType
8{
9 enum EnumType
10 {
11 File = 0,
12 Resource,
13 };
14};
15
[624]16class ImageControlInfo
[615]17{
[624]18public:
[615]19 ImageReferenceType::EnumType type;
20 std::string path;
[624]21
22 bool IsFile() const
23 {
24 return ( type == ImageReferenceType::File );
25 }
26 bool IsResource() const
27 {
28 return ( type == ImageReferenceType::Resource );
29 }
[615]30};
31
[624]32class WindowInfoBase
33{
34public:
35 const std::string &GetName() const
36 {
37 return name;
38 }
39 void SetName( const std::string &name )
40 {
41 this->name = name;
42 }
[615]43
[624]44 const std::string &GetCaption() const
45 {
46 return caption;
47 }
48 void SetCaption( const std::string &caption )
49 {
50 this->caption = caption;
51 }
[615]52
[624]53 DWORD GetStyle() const
54 {
55 return style;
56 }
57 void SetStyle( DWORD style )
58 {
59 this->style = style;
60 }
61 void AddStyle( DWORD style )
62 {
63 this->style |= style;
64 }
65 void AndStyle( DWORD style )
66 {
67 this->style &= style;
68 }
69 void DeleteStyle( DWORD style )
70 {
71 this->style &= ~style;
72 }
[615]73
[624]74 DWORD GetExStyle() const
75 {
76 return exstyle;
77 }
78 void SetExStyle( DWORD exstyle )
79 {
80 this->exstyle = exstyle;
81 }
82 void AddExStyle( DWORD exstyle )
83 {
84 this->exstyle |= exstyle;
85 }
86
87private:
88 std::string name;
89 std::string caption;
90 DWORD style;
91 DWORD exstyle;
92
93public:
94 POINT pos;
95 SIZE size;
[615]96};
97
[624]98class ChildWindowInfo
99 : public WindowInfoBase
[616]100{
101public:
[615]102 int Control;
103
[624]104 ImageControlInfo image;
[615]105};
[624]106typedef std::vector<ChildWindowInfo *> ChildWindowInfos;
[615]107class WindowInfo
[624]108 : public WindowInfoBase
[615]109{
110public:
111 WindowInfo()
[624]112 : WindowInfoBase()
[615]113 , CallBackName( NULL )
114 {
115 }
116
[624]117 const std::string &GetClassName() const
[617]118 {
[624]119 return className;
[617]120 }
[624]121 void SetClassName( const std::string &className )
[617]122 {
[624]123 this->className = className;
[617]124 }
125
[624]126 const std::string &GetHandleName() const
127 {
128 return handleName;
129 }
[617]130 void SetHandleName( const std::string &handleName )
131 {
132 this->handleName = handleName;
133 }
[624]134
135 const std::string &GetMenuIdName() const
[617]136 {
[624]137 return menuIdName;
[617]138 }
[624]139 void SetMenuIdName( const std::string &menuIdName )
140 {
141 this->menuIdName = menuIdName;
142 }
143 bool HasMenu() const
144 {
145 return !menuIdName.empty();
146 }
[617]147
[624]148 int GetBackgroundColor() const
149 {
150 return backgroundColor;
151 }
152 void SetBackgroundColor( int backgroundColor )
153 {
154 this->backgroundColor = backgroundColor;
155 }
156
157 const std::string &GetIconResourceName() const
158 {
159 return iconResourceName;
160 }
161 void SetIconResourceName( const std::string &iconResourceName )
162 {
163 this->iconResourceName = iconResourceName;
164 }
165 bool HasIcon() const
166 {
167 return !iconResourceName.empty();
168 }
169
[615]170 //ウィンドウデータ
171 LOGFONT LogFont;
172 char *CallBackName;
173 long type;
174 char *filepath;
175
176 //子ウィンドウ管理
[624]177 ChildWindowInfos childWindowInfos;
[615]178
179 //ツリー項目
180 HTREEITEM hTreeItem;
[617]181
182private:
[624]183 std::string className;
[617]184 std::string handleName;
[624]185 std::string menuIdName;
186 int backgroundColor;
187 std::string iconResourceName;
[615]188};
189
190class WindowInfos
191 : public std::vector<WindowInfo *>
192{
193public:
194 WindowInfos()
195 {
196 }
197 ~WindowInfos()
198 {
199 }
200
201 void Clear()
202 {
203 WindowInfos &windowInfos = *this;
204 BOOST_FOREACH( WindowInfo *pWindowInfo, windowInfos )
205 {
206 delete pWindowInfo;
207 }
208 this->clear();
209 }
210 void Erase( int index )
211 {
212 WindowInfos::iterator it = this->begin();
213 for( int i=0; i!=index ;i++, it++ )
214 {
215 delete *it;
216 }
217 this->erase( it );
218 }
219};
[624]220
221
222}}
Note: See TracBrowser for help on using the repository browser.