guiInspectorTypes.h
Engine/source/gui/editor/guiInspectorTypes.h
Classes:
class
class
A base class for other inspector field types which wish to display a popup/dropdown menu.
class
class
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23#ifndef _GUI_INSPECTOR_TYPES_H_ 24#define _GUI_INSPECTOR_TYPES_H_ 25 26#ifndef _GUI_INSPECTOR_H_ 27#include "gui/editor/guiInspector.h" 28#endif 29 30#ifndef _GUI_INSPECTOR_FIELD_H_ 31#include "gui/editor/inspector/field.h" 32#endif 33 34#ifndef _GUICONTROL_H_ 35#include "gui/core/guiControl.h" 36#endif 37 38#ifndef _GUICHECKBOXCTRL_H_ 39#include "gui/buttons/guiCheckBoxCtrl.h" 40#endif 41 42#ifndef _GUIBITMAPBUTTON_H_ 43#include "gui/buttons/guiBitmapButtonCtrl.h" 44#endif 45 46class GuiPopUpMenuCtrl; 47 48/// A base class for other inspector field types which 49/// wish to display a popup/dropdown menu. 50class GuiInspectorTypeMenuBase : public GuiInspectorField 51{ 52private: 53 typedef GuiInspectorField Parent; 54public: 55 56 DECLARE_CONOBJECT(GuiInspectorTypeMenuBase); 57 58 //----------------------------------------------------------------------------- 59 // Override able methods for custom edit fields 60 //----------------------------------------------------------------------------- 61 virtual GuiControl* constructEditControl(); 62 virtual void setValue( StringTableEntry newValue ); 63 virtual void _populateMenu( GuiPopUpMenuCtrl *menu ); 64}; 65 66//----------------------------------------------------------------------------- 67// TypeEnum GuiInspectorField Class 68//----------------------------------------------------------------------------- 69class GuiInspectorTypeEnum : public GuiInspectorTypeMenuBase 70{ 71private: 72 typedef GuiInspectorTypeMenuBase Parent; 73public: 74 DECLARE_CONOBJECT(GuiInspectorTypeEnum); 75 static void consoleInit(); 76 77 virtual void _populateMenu( GuiPopUpMenuCtrl *menu ); 78}; 79 80//----------------------------------------------------------------------------- 81// TypeCubemapName GuiInspectorField Class 82//----------------------------------------------------------------------------- 83class GuiInspectorTypeCubemapName : public GuiInspectorTypeMenuBase 84{ 85private: 86 typedef GuiInspectorTypeMenuBase Parent; 87public: 88 DECLARE_CONOBJECT(GuiInspectorTypeCubemapName); 89 static void consoleInit(); 90 91 virtual void _populateMenu( GuiPopUpMenuCtrl *menu ); 92}; 93 94//-------------------------------------------------------------------------------- 95// TypeMaterialName GuiInspectorField Class 96//-------------------------------------------------------------------------------- 97class GuiBitmapButtonCtrl; 98 99class GuiInspectorTypeMaterialName : public GuiInspectorField 100{ 101 typedef GuiInspectorField Parent; 102 103public: 104 105 GuiInspectorTypeMaterialName(); 106 107 DECLARE_CONOBJECT(GuiInspectorTypeMaterialName); 108 static void consoleInit(); 109 110 GuiBitmapButtonCtrl *mBrowseButton; 111 RectI mBrowseRect; 112 113 GuiControl* construct(const char* command); 114 115 //----------------------------------------------------------------------------- 116 // Override able methods for custom edit fields 117 //----------------------------------------------------------------------------- 118 virtual GuiControl* constructEditControl(); 119 virtual bool updateRects(); 120}; 121 122class GuiInspectorTypeRegularMaterialName : public GuiInspectorTypeMaterialName 123{ 124 typedef GuiInspectorTypeMaterialName Parent; 125public: 126 GuiInspectorTypeRegularMaterialName() {} 127 DECLARE_CONOBJECT(GuiInspectorTypeRegularMaterialName); 128 static void consoleInit(); 129 virtual void _populateMenu( GuiPopUpMenuCtrl *menu ); 130}; 131 132//-------------------------------------------------------------------------------- 133// TypeTerrainMaterialIndex GuiInspectorField Class 134//-------------------------------------------------------------------------------- 135class GuiInspectorTypeTerrainMaterialIndex : public GuiInspectorTypeMaterialName 136{ 137 typedef GuiInspectorTypeMaterialName Parent; 138 139public: 140 141 GuiInspectorTypeTerrainMaterialIndex() {} 142 143 DECLARE_CONOBJECT(GuiInspectorTypeTerrainMaterialIndex); 144 static void consoleInit(); 145 146 //----------------------------------------------------------------------------- 147 // Override able methods for custom edit fields 148 //----------------------------------------------------------------------------- 149 virtual GuiControl* constructEditControl(); 150}; 151 152//-------------------------------------------------------------------------------- 153// TypeTerrainMaterialName GuiInspectorField Class 154//-------------------------------------------------------------------------------- 155class GuiInspectorTypeTerrainMaterialName : public GuiInspectorTypeMaterialName 156{ 157 typedef GuiInspectorTypeMaterialName Parent; 158 159public: 160 161 GuiInspectorTypeTerrainMaterialName() {} 162 163 DECLARE_CONOBJECT(GuiInspectorTypeTerrainMaterialName); 164 static void consoleInit(); 165 GuiControl* construct(const char* command); 166 //----------------------------------------------------------------------------- 167 // Override able methods for custom edit fields 168 //----------------------------------------------------------------------------- 169 virtual GuiControl* constructEditControl(); 170}; 171 172//----------------------------------------------------------------------------- 173// GuiInspectorTypeGuiProfile Class 174//----------------------------------------------------------------------------- 175class GuiInspectorTypeGuiProfile : public GuiInspectorTypeMenuBase 176{ 177private: 178 typedef GuiInspectorTypeMenuBase Parent; 179public: 180 DECLARE_CONOBJECT(GuiInspectorTypeGuiProfile); 181 static void consoleInit(); 182 183 virtual void _populateMenu( GuiPopUpMenuCtrl *menu ); 184}; 185 186//----------------------------------------------------------------------------- 187// GuiInspectorTypeCheckBox Class 188//----------------------------------------------------------------------------- 189class GuiInspectorTypeCheckBox : public GuiInspectorField 190{ 191private: 192 typedef GuiInspectorField Parent; 193public: 194 DECLARE_CONOBJECT(GuiInspectorTypeCheckBox); 195 static void consoleInit(); 196 197 //----------------------------------------------------------------------------- 198 // Override able methods for custom edit fields 199 //----------------------------------------------------------------------------- 200 virtual GuiControl* constructEditControl(); 201 virtual void setValue( StringTableEntry newValue ); 202 virtual const char* getValue(); 203}; 204 205//----------------------------------------------------------------------------- 206// TypeCommand GuiInspectorField Class 207//----------------------------------------------------------------------------- 208class GuiInspectorTypeCommand : public GuiInspectorField 209{ 210private: 211 typedef GuiInspectorField Parent; 212 StringTableEntry mTextEditorCommand; 213 void _setCommand( GuiButtonCtrl *ctrl, StringTableEntry command ); 214public: 215 DECLARE_CONOBJECT(GuiInspectorTypeCommand); 216 GuiInspectorTypeCommand(); 217 static void consoleInit(); 218 219 //----------------------------------------------------------------------------- 220 // Override able methods for custom edit fields 221 //----------------------------------------------------------------------------- 222 virtual GuiControl* constructEditControl(); 223 virtual void setValue( StringTableEntry data ); 224}; 225 226//----------------------------------------------------------------------------- 227// TypeFileName GuiInspectorField Class 228//----------------------------------------------------------------------------- 229class GuiInspectorTypeFileName : public GuiInspectorField 230{ 231private: 232 typedef GuiInspectorField Parent; 233public: 234 DECLARE_CONOBJECT(GuiInspectorTypeFileName); 235 static void consoleInit(); 236 237 SimObjectPtr<GuiButtonCtrl> mBrowseButton; 238 RectI mBrowseRect; 239 240 //----------------------------------------------------------------------------- 241 // Override able methods for custom edit fields 242 //----------------------------------------------------------------------------- 243 virtual GuiControl* constructEditControl(); 244 virtual bool resize(const Point2I &newPosition, const Point2I &newExtent); 245 virtual bool updateRects(); 246 virtual void updateValue(); 247}; 248 249 250//----------------------------------------------------------------------------- 251// TypeImageFileName GuiInspectorField Class 252//----------------------------------------------------------------------------- 253class GuiInspectorTypeImageFileName : public GuiInspectorTypeFileName 254{ 255 typedef GuiInspectorTypeFileName Parent; 256public: 257 258 DECLARE_CONOBJECT(GuiInspectorTypeImageFileName); 259 static void consoleInit(); 260 261 virtual GuiControl* constructEditControl(); 262 bool renderTooltip( const Point2I &hoverPos, const Point2I &cursorPos, const char *tipText = NULL ); 263}; 264 265//----------------------------------------------------------------------------- 266// TypeRectUV GuiInspectorField Class 267//----------------------------------------------------------------------------- 268class GuiInspectorTypeRectUV : public GuiInspectorField 269{ 270 typedef GuiInspectorField Parent; 271public: 272 GuiBitmapButtonCtrl *mBrowseButton; 273 RectI mBrowseRect; 274 275public: 276 DECLARE_CONOBJECT(GuiInspectorTypeRectUV); 277 GuiInspectorTypeRectUV(); 278 static void consoleInit(); 279 280 //----------------------------------------------------------------------------- 281 // Override able methods for custom edit fields 282 //----------------------------------------------------------------------------- 283 virtual GuiControl* constructEditControl(); 284 virtual bool updateRects(); 285}; 286 287//----------------------------------------------------------------------------- 288// TypeEaseF GuiInspectorField Class 289//----------------------------------------------------------------------------- 290 291class GuiInspectorTypeEaseF : public GuiInspectorField 292{ 293 public: 294 295 typedef GuiInspectorField Parent; 296 297 protected: 298 299 SimObjectPtr<GuiButtonCtrl> mBrowseButton; 300 RectI mBrowseRect; 301 302 public: 303 304 GuiInspectorTypeEaseF(); 305 306 DECLARE_CONOBJECT( GuiInspectorTypeEaseF ); 307 308 static void consoleInit(); 309 310 //----------------------------------------------------------------------------- 311 // Override able methods for custom edit fields 312 //----------------------------------------------------------------------------- 313 virtual GuiControl* constructEditControl(); 314 virtual bool resize(const Point2I &newPosition, const Point2I &newExtent); 315 virtual bool updateRects(); 316}; 317 318//----------------------------------------------------------------------------- 319// TypePrefabFilename GuiInspectorField Class 320//----------------------------------------------------------------------------- 321class GuiInspectorTypePrefabFilename : public GuiInspectorTypeFileName 322{ 323 typedef GuiInspectorTypeFileName Parent; 324public: 325 326 DECLARE_CONOBJECT(GuiInspectorTypePrefabFilename); 327 static void consoleInit(); 328 329 virtual GuiControl* constructEditControl(); 330}; 331 332//----------------------------------------------------------------------------- 333// TypeShapeFilename GuiInspectorField Class 334//----------------------------------------------------------------------------- 335class GuiInspectorTypeShapeFilename : public GuiInspectorTypeFileName 336{ 337 typedef GuiInspectorTypeFileName Parent; 338public: 339 340 GuiBitmapButtonCtrl *mShapeEdButton; 341 342 DECLARE_CONOBJECT(GuiInspectorTypeShapeFilename); 343 static void consoleInit(); 344 345 virtual GuiControl* constructEditControl(); 346 virtual bool updateRects(); 347}; 348 349//----------------------------------------------------------------------------- 350// TypeColor GuiInspectorField Class (Base for ColorI/LinearColorF) 351//----------------------------------------------------------------------------- 352 353class GuiSwatchButtonCtrl; 354 355class GuiInspectorTypeColor : public GuiInspectorField 356{ 357 typedef GuiInspectorField Parent; 358 359protected: 360 361 /// Return the name of a function that will be used to convert the 362 /// floating-point color of the swatch button to the form used by the 363 /// data field. 364 virtual const char* _getColorConversionFunction() const { return NULL; } 365 366public: 367 368 GuiInspectorTypeColor(); 369 370 DECLARE_CONOBJECT(GuiInspectorTypeColor); 371 372 StringTableEntry mColorFunction; 373 GuiSwatchButtonCtrl *mBrowseButton; 374 RectI mBrowseRect; 375 376 //----------------------------------------------------------------------------- 377 // Override able methods for custom edit fields 378 //----------------------------------------------------------------------------- 379 virtual GuiControl* constructEditControl(); 380 virtual bool resize(const Point2I &newPosition, const Point2I &newExtent); 381 virtual bool updateRects(); 382}; 383 384//----------------------------------------------------------------------------- 385// TypeColorI GuiInspectorField Class 386//----------------------------------------------------------------------------- 387class GuiInspectorTypeColorI : public GuiInspectorTypeColor 388{ 389 typedef GuiInspectorTypeColor Parent; 390 391protected: 392 393 virtual const char* _getColorConversionFunction() const { return "ColorFloatToInt"; } 394 395public: 396 397 GuiInspectorTypeColorI(); 398 399 DECLARE_CONOBJECT(GuiInspectorTypeColorI); 400 401 static void consoleInit(); 402 void setValue( StringTableEntry newValue ); 403}; 404 405//----------------------------------------------------------------------------- 406// TypeColorF GuiInspectorField Class 407//----------------------------------------------------------------------------- 408class GuiInspectorTypeColorF : public GuiInspectorTypeColor 409{ 410 typedef GuiInspectorTypeColor Parent; 411 412public: 413 414 GuiInspectorTypeColorF(); 415 416 DECLARE_CONOBJECT(GuiInspectorTypeColorF); 417 418 static void consoleInit(); 419 void setValue( StringTableEntry newValue ); 420}; 421 422/* NOTE: Evidently this isn't used anywhere (or implemented) so i commented it out 423//------------------------------------------------------------------------------ 424// TypeString GuiInspectorField class 425//------------------------------------------------------------------------------ 426class GuiInspectorTypeString : public GuiInspectorField 427{ 428private: 429 typedef GuiInspectorField Parent; 430public: 431 DECLARE_CONOBJECT(GuiInspectorTypeString); 432 static void consoleInit(); 433 434 SimObjectPtr<GuiButtonCtrl> mBrowseButton; 435 436 virtual GuiControl* constructEditControl(); 437 virtual bool resize(const Point2I &newPosition, const Point2I &newExtent); 438 virtual bool updateRects(); 439}; 440*/ 441 442 443//------------------------------------------------------------------------------ 444// TypeS32 GuiInspectorField class 445//------------------------------------------------------------------------------ 446class GuiInspectorTypeS32 : public GuiInspectorField 447{ 448private: 449 typedef GuiInspectorField Parent; 450public: 451 DECLARE_CONOBJECT(GuiInspectorTypeS32); 452 static void consoleInit(); 453 454 virtual GuiControl* constructEditControl(); 455 virtual void setValue( StringTableEntry newValue ); 456}; 457 458 459//------------------------------------------------------------------------------ 460// TypeBitMask32 GuiInspectorField class 461//------------------------------------------------------------------------------ 462class GuiInspectorTypeBitMask32Helper; 463class GuiDynamicCtrlArrayControl; 464 465class GuiInspectorTypeBitMask32 : public GuiInspectorField 466{ 467 typedef GuiInspectorField Parent; 468 469public: 470 471 GuiInspectorTypeBitMask32(); 472 virtual ~GuiInspectorTypeBitMask32() {} 473 474 DECLARE_CONOBJECT( GuiInspectorTypeBitMask32 ); 475 476 // ConsoleObject 477 bool onAdd(); 478 static void consoleInit(); 479 480 // GuiInspectorField 481 virtual void childResized( GuiControl *child ); 482 virtual bool resize( const Point2I &newPosition, const Point2I &newExtent ); 483 virtual bool updateRects(); 484 virtual void updateData(); 485 virtual StringTableEntry getValue(); 486 virtual void setValue( StringTableEntry value ); 487 488protected: 489 490 GuiInspectorTypeBitMask32Helper *mHelper; 491 GuiRolloutCtrl *mRollout; 492 GuiDynamicCtrlArrayControl *mArrayCtrl; 493 Vector<GuiInspectorField*> mChildren; 494}; 495 496class GuiInspectorTypeBitMask32Helper : public GuiInspectorField 497{ 498 typedef GuiInspectorField Parent; 499 500public: 501 502 GuiInspectorTypeBitMask32Helper(); 503 504 DECLARE_CONOBJECT( GuiInspectorTypeBitMask32Helper ); 505 506 GuiBitmapButtonCtrl *mButton; 507 GuiRolloutCtrl *mParentRollout; 508 GuiInspectorTypeBitMask32 *mParentField; 509 RectI mButtonRect; 510 511 //----------------------------------------------------------------------------- 512 // Override able methods for custom edit fields 513 //----------------------------------------------------------------------------- 514 virtual GuiControl* constructEditControl(); 515 virtual bool resize( const Point2I &newPosition, const Point2I &newExtent ); 516 virtual bool updateRects(); 517 virtual void setValue( StringTableEntry value ); 518}; 519 520 521//----------------------------------------------------------------------------- 522// TypeName GuiInspectorField Class 523//----------------------------------------------------------------------------- 524class GuiInspectorTypeName : public GuiInspectorField 525{ 526private: 527 typedef GuiInspectorField Parent; 528public: 529 DECLARE_CONOBJECT(GuiInspectorTypeName); 530 static void consoleInit(); 531 532 virtual bool verifyData( StringTableEntry data ); 533}; 534 535 536//----------------------------------------------------------------------------- 537// TypeSFXParameterName GuiInspectorField Class 538//----------------------------------------------------------------------------- 539class GuiInspectorTypeSFXParameterName : public GuiInspectorTypeMenuBase 540{ 541private: 542 typedef GuiInspectorTypeMenuBase Parent; 543public: 544 DECLARE_CONOBJECT(GuiInspectorTypeSFXParameterName); 545 static void consoleInit(); 546 547 virtual void _populateMenu( GuiPopUpMenuCtrl *menu ); 548}; 549 550 551//----------------------------------------------------------------------------- 552// TypeSFXStateName GuiInspectorField Class 553//----------------------------------------------------------------------------- 554class GuiInspectorTypeSFXStateName : public GuiInspectorTypeMenuBase 555{ 556private: 557 typedef GuiInspectorTypeMenuBase Parent; 558public: 559 DECLARE_CONOBJECT(GuiInspectorTypeSFXStateName); 560 static void consoleInit(); 561 562 virtual void _populateMenu( GuiPopUpMenuCtrl *menu ); 563}; 564 565 566//----------------------------------------------------------------------------- 567// TypeSFXSourceName GuiInspectorField Class 568//----------------------------------------------------------------------------- 569class GuiInspectorTypeSFXSourceName : public GuiInspectorTypeMenuBase 570{ 571private: 572 typedef GuiInspectorTypeMenuBase Parent; 573public: 574 DECLARE_CONOBJECT(GuiInspectorTypeSFXSourceName); 575 static void consoleInit(); 576 577 virtual void _populateMenu( GuiPopUpMenuCtrl *menu ); 578}; 579 580 581#endif // _GUI_INSPECTOR_TYPES_H_ 582