guiBorderButton.cpp
Engine/source/gui/buttons/guiBorderButton.cpp
Classes:
class
Public Functions
ConsoleDocClass(GuiBorderButtonCtrl , "@brief A push button that renders only <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">border.\n\n</a>" "A border button consists of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> border rendered along its extents according <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the border thickness defined in its profile " "(GuiControlProfile::border). For the border color, <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> color is selected from the profile according <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> current button <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state:\n</a>" "- Default <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state:GuiControlProfile::borderColor\n</a>" "- Highlighted(mouse is over the button):<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControlProfile::fontColorHL\n</a>" "- Depressed(mouse button down but not yet released):<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControlProfile::fontColorSEL\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiButtons\n</a>" )
Detailed Description
Public Functions
ConsoleDocClass(GuiBorderButtonCtrl , "@brief A push button that renders only <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">border.\n\n</a>" "A border button consists of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> border rendered along its extents according <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the border thickness defined in its profile " "(GuiControlProfile::border). For the border color, <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> color is selected from the profile according <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> current button <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state:\n</a>" "- Default <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state:GuiControlProfile::borderColor\n</a>" "- Highlighted(mouse is over the button):<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControlProfile::fontColorHL\n</a>" "- Depressed(mouse button down but not yet released):<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControlProfile::fontColorSEL\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiButtons\n</a>" )
IMPLEMENT_CONOBJECT(GuiBorderButtonCtrl )
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#include "platform/platform.h" 25 26#include "gfx/gfxDevice.h" 27#include "gfx/gfxDrawUtil.h" 28#include "gui/core/guiCanvas.h" 29#include "gui/buttons/guiButtonBaseCtrl.h" 30#include "gui/core/guiDefaultControlRender.h" 31 32 33class GuiBorderButtonCtrl : public GuiButtonBaseCtrl 34{ 35 typedef GuiButtonBaseCtrl Parent; 36 37protected: 38public: 39 DECLARE_CONOBJECT(GuiBorderButtonCtrl); 40 41 void onRender(Point2I offset, const RectI &updateRect); 42}; 43 44IMPLEMENT_CONOBJECT(GuiBorderButtonCtrl); 45 46ConsoleDocClass( GuiBorderButtonCtrl, 47 "@brief A push button that renders only a border.\n\n" 48 49 "A border button consists of a border rendered along its extents according to the border thickness defined in its profile " 50 "(GuiControlProfile::border). For the border color, a color is selected from the profile according to current button state:\n" 51 52 "- Default state: GuiControlProfile::borderColor\n" 53 "- Highlighted (mouse is over the button): GuiControlProfile::fontColorHL\n" 54 "- Depressed (mouse button down but not yet released): GuiControlProfile::fontColorSEL\n" 55 56 "@ingroup GuiButtons\n" 57); 58 59void GuiBorderButtonCtrl::onRender(Point2I offset, const RectI &updateRect) 60{ 61 if ( mProfile->mBorder > 0 ) 62 { 63 RectI bounds( offset, getExtent() ); 64 for ( S32 i=0; i < mProfile->mBorderThickness; i++ ) 65 { 66 GFX->getDrawUtil()->drawRect( bounds, mProfile->mBorderColor ); 67 bounds.inset( 1, 1 ); 68 } 69 } 70 71 if ( mActive ) 72 { 73 if ( mStateOn || mDepressed ) 74 { 75 RectI bounds( offset, getExtent() ); 76 for ( S32 i=0; i < mProfile->mBorderThickness; i++ ) 77 { 78 GFX->getDrawUtil()->drawRect( bounds, mProfile->mFontColorSEL ); 79 bounds.inset( 1, 1 ); 80 } 81 } 82 83 if ( mMouseOver ) 84 { 85 RectI bounds( offset, getExtent() ); 86 for ( S32 i=0; i < mProfile->mBorderThickness; i++ ) 87 { 88 GFX->getDrawUtil()->drawRect( bounds, mProfile->mFontColorHL ); 89 bounds.inset( 1, 1 ); 90 } 91 } 92 } 93 94 renderChildControls( offset, updateRect ); 95} 96 97