guiProgressBitmapCtrl.h
Engine/source/gui/game/guiProgressBitmapCtrl.h
Classes:
class
A control that renders a horizontal progress bar from a repeating bitmap image.
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 24#ifndef _GuiProgressBitmapCtrl_H_ 25#define _GuiProgressBitmapCtrl_H_ 26 27#ifndef _GUICONTROL_H_ 28#include "gui/core/guiControl.h" 29#endif 30 31#ifndef _GUITEXTCTRL_H_ 32#include "gui/controls/guiTextCtrl.h" 33#endif 34 35 36//FIXME: WTH is this derived from GuiTextCtrl?? should be a GuiControl 37 38 39/// A control that renders a horizontal progress bar from a repeating bitmap image. 40class GuiProgressBitmapCtrl : public GuiTextCtrl 41{ 42 public: 43 44 typedef GuiTextCtrl Parent; 45 46 protected: 47 48 F32 mProgress; 49 StringTableEntry mBitmapName; 50 bool mUseVariable; 51 bool mTile; 52 S32 mNumberOfBitmaps; 53 S32 mDim; 54 55 static bool _setBitmap( void* object, const char* index, const char* data ) 56 { 57 static_cast< GuiProgressBitmapCtrl* >( object )->setBitmap( data ); 58 return false; 59 } 60 61 public: 62 63 GuiProgressBitmapCtrl(); 64 65 void setBitmap( const char* name ); 66 67 //console related methods 68 virtual const char *getScriptValue(); 69 virtual void setScriptValue(const char *value); 70 71 // GuiTextCtrl. 72 virtual void onPreRender(); 73 virtual void onRender( Point2I offset, const RectI &updateRect ); 74 virtual bool onWake(); 75 76 DECLARE_CONOBJECT( GuiProgressBitmapCtrl ); 77 DECLARE_CATEGORY( "Gui Values" ); 78 DECLARE_DESCRIPTION( "A control that shows a horizontal progress bar that is rendered\n" 79 "by repeating a bitmap." ); 80 81 static void initPersistFields(); 82}; 83 84#endif 85