[615] | 1 | #pragma once
|
---|
| 2 |
|
---|
| 3 |
|
---|
[624] | 4 | namespace ActiveBasic{ namespace PM{
|
---|
[615] | 5 |
|
---|
[624] | 6 |
|
---|
[615] | 7 | struct ImageReferenceType
|
---|
| 8 | {
|
---|
| 9 | enum EnumType
|
---|
| 10 | {
|
---|
| 11 | File = 0,
|
---|
| 12 | Resource,
|
---|
| 13 | };
|
---|
| 14 | };
|
---|
| 15 |
|
---|
[624] | 16 | class ImageControlInfo
|
---|
[615] | 17 | {
|
---|
[624] | 18 | public:
|
---|
[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] | 32 | class WindowInfoBase
|
---|
| 33 | {
|
---|
| 34 | public:
|
---|
| 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 |
|
---|
| 87 | private:
|
---|
| 88 | std::string name;
|
---|
| 89 | std::string caption;
|
---|
| 90 | DWORD style;
|
---|
| 91 | DWORD exstyle;
|
---|
| 92 |
|
---|
| 93 | public:
|
---|
| 94 | POINT pos;
|
---|
| 95 | SIZE size;
|
---|
[615] | 96 | };
|
---|
| 97 |
|
---|
[624] | 98 | class ChildWindowInfo
|
---|
| 99 | : public WindowInfoBase
|
---|
[616] | 100 | {
|
---|
| 101 | public:
|
---|
[615] | 102 | int Control;
|
---|
| 103 |
|
---|
[624] | 104 | ImageControlInfo image;
|
---|
[615] | 105 | };
|
---|
[624] | 106 | typedef std::vector<ChildWindowInfo *> ChildWindowInfos;
|
---|
[625] | 107 |
|
---|
| 108 | struct WindowType
|
---|
| 109 | {
|
---|
| 110 | enum EnumType
|
---|
| 111 | {
|
---|
| 112 | Default = 0,
|
---|
| 113 | ModalDlg = 1,
|
---|
| 114 | ModelessDlg = 3,
|
---|
| 115 | };
|
---|
| 116 | };
|
---|
| 117 |
|
---|
[615] | 118 | class WindowInfo
|
---|
[624] | 119 | : public WindowInfoBase
|
---|
[615] | 120 | {
|
---|
| 121 | public:
|
---|
[625] | 122 |
|
---|
| 123 | const std::string GetSourceFileName() const
|
---|
[615] | 124 | {
|
---|
[625] | 125 | return this->GetName() + ".ab";
|
---|
[615] | 126 | }
|
---|
| 127 |
|
---|
[629] | 128 | const std::string GetSourceFileNameForOldVer( const std::string &baseDir ) const
|
---|
| 129 | {
|
---|
| 130 | if( Jenga::Common::Path( baseDir + this->GetName() + ".ab" ).IsExistFile() )
|
---|
| 131 | {
|
---|
| 132 | return this->GetName() + ".ab";
|
---|
| 133 | }
|
---|
| 134 | if( Jenga::Common::Path( baseDir + this->GetName() + ".abp" ).IsExistFile() )
|
---|
| 135 | {
|
---|
| 136 | return this->GetName() + ".abp";
|
---|
| 137 | }
|
---|
| 138 | if( Jenga::Common::Path( baseDir + this->GetName() + ".sbp" ).IsExistFile() )
|
---|
| 139 | {
|
---|
| 140 | return this->GetName() + ".sbp";
|
---|
| 141 | }
|
---|
| 142 | return this->GetName() + ".ab";
|
---|
| 143 | }
|
---|
| 144 |
|
---|
[624] | 145 | const std::string &GetClassName() const
|
---|
[617] | 146 | {
|
---|
[624] | 147 | return className;
|
---|
[617] | 148 | }
|
---|
[624] | 149 | void SetClassName( const std::string &className )
|
---|
[617] | 150 | {
|
---|
[624] | 151 | this->className = className;
|
---|
[617] | 152 | }
|
---|
| 153 |
|
---|
[625] | 154 | const std::string GetHandleName() const
|
---|
[624] | 155 | {
|
---|
[625] | 156 | return "h" + this->GetName();
|
---|
[624] | 157 | }
|
---|
[625] | 158 |
|
---|
| 159 | const std::string GetCallbackName() const
|
---|
[617] | 160 | {
|
---|
[625] | 161 | return this->GetName() + "Proc";
|
---|
[617] | 162 | }
|
---|
[624] | 163 |
|
---|
| 164 | const std::string &GetMenuIdName() const
|
---|
[617] | 165 | {
|
---|
[624] | 166 | return menuIdName;
|
---|
[617] | 167 | }
|
---|
[624] | 168 | void SetMenuIdName( const std::string &menuIdName )
|
---|
| 169 | {
|
---|
| 170 | this->menuIdName = menuIdName;
|
---|
| 171 | }
|
---|
| 172 | bool HasMenu() const
|
---|
| 173 | {
|
---|
| 174 | return !menuIdName.empty();
|
---|
| 175 | }
|
---|
[617] | 176 |
|
---|
[624] | 177 | int GetBackgroundColor() const
|
---|
| 178 | {
|
---|
| 179 | return backgroundColor;
|
---|
| 180 | }
|
---|
| 181 | void SetBackgroundColor( int backgroundColor )
|
---|
| 182 | {
|
---|
| 183 | this->backgroundColor = backgroundColor;
|
---|
| 184 | }
|
---|
| 185 |
|
---|
| 186 | const std::string &GetIconResourceName() const
|
---|
| 187 | {
|
---|
| 188 | return iconResourceName;
|
---|
| 189 | }
|
---|
| 190 | void SetIconResourceName( const std::string &iconResourceName )
|
---|
| 191 | {
|
---|
| 192 | this->iconResourceName = iconResourceName;
|
---|
| 193 | }
|
---|
| 194 | bool HasIcon() const
|
---|
| 195 | {
|
---|
| 196 | return !iconResourceName.empty();
|
---|
| 197 | }
|
---|
| 198 |
|
---|
[625] | 199 | WindowType::EnumType GetType() const
|
---|
| 200 | {
|
---|
| 201 | return type;
|
---|
| 202 | }
|
---|
| 203 | void SetType( WindowType::EnumType type )
|
---|
| 204 | {
|
---|
| 205 | this->type = type;
|
---|
| 206 | }
|
---|
| 207 | bool IsDefaultWindow() const
|
---|
| 208 | {
|
---|
| 209 | return ( type == WindowType::Default );
|
---|
| 210 | }
|
---|
| 211 | bool IsModalDlg() const
|
---|
| 212 | {
|
---|
| 213 | return ( type == WindowType::ModalDlg );
|
---|
| 214 | }
|
---|
| 215 | bool IsModelessDlg() const
|
---|
| 216 | {
|
---|
| 217 | return ( type == WindowType::ModelessDlg );
|
---|
| 218 | }
|
---|
| 219 |
|
---|
[615] | 220 | //ウィンドウデータ
|
---|
| 221 | LOGFONT LogFont;
|
---|
| 222 |
|
---|
| 223 | //子ウィンドウ管理
|
---|
[624] | 224 | ChildWindowInfos childWindowInfos;
|
---|
[615] | 225 |
|
---|
| 226 | //ツリー項目
|
---|
| 227 | HTREEITEM hTreeItem;
|
---|
[617] | 228 |
|
---|
| 229 | private:
|
---|
[624] | 230 | std::string className;
|
---|
[617] | 231 | std::string handleName;
|
---|
[624] | 232 | std::string menuIdName;
|
---|
| 233 | int backgroundColor;
|
---|
| 234 | std::string iconResourceName;
|
---|
[625] | 235 | WindowType::EnumType type;
|
---|
[615] | 236 | };
|
---|
| 237 |
|
---|
| 238 | class WindowInfos
|
---|
| 239 | : public std::vector<WindowInfo *>
|
---|
| 240 | {
|
---|
| 241 | public:
|
---|
| 242 | WindowInfos()
|
---|
| 243 | {
|
---|
| 244 | }
|
---|
| 245 | ~WindowInfos()
|
---|
| 246 | {
|
---|
| 247 | }
|
---|
| 248 |
|
---|
| 249 | void Clear()
|
---|
| 250 | {
|
---|
| 251 | WindowInfos &windowInfos = *this;
|
---|
| 252 | BOOST_FOREACH( WindowInfo *pWindowInfo, windowInfos )
|
---|
| 253 | {
|
---|
| 254 | delete pWindowInfo;
|
---|
| 255 | }
|
---|
| 256 | this->clear();
|
---|
| 257 | }
|
---|
| 258 | void Erase( int index )
|
---|
| 259 | {
|
---|
| 260 | WindowInfos::iterator it = this->begin();
|
---|
[625] | 261 | int i = 0;
|
---|
| 262 | while( i < index )
|
---|
[615] | 263 | {
|
---|
[625] | 264 | i ++;
|
---|
| 265 | it ++;
|
---|
[615] | 266 | }
|
---|
| 267 | this->erase( it );
|
---|
| 268 | }
|
---|
| 269 | };
|
---|
[624] | 270 |
|
---|
| 271 |
|
---|
| 272 | }}
|
---|