guiBitmapButtonCtrl.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #include "platform/platform.h"
  23. #include "gui/buttons/guiBitmapButtonCtrl.h"
  24. #include "core/util/path.h"
  25. #include "console/console.h"
  26. #include "console/consoleTypes.h"
  27. #include "console/engineAPI.h"
  28. #include "gui/core/guiCanvas.h"
  29. #include "gui/core/guiDefaultControlRender.h"
  30. #include "gfx/gfxDrawUtil.h"
  31. #include "gfx/gfxTextureManager.h"
  32. ImplementEnumType( GuiBitmapMode,
  33. "Rendering behavior when placing bitmaps in controls.\n\n"
  34. "@ingroup GuiImages" )
  35. { GuiBitmapButtonCtrl::BitmapStretched, "Stretched", "Stretch bitmap to fit control extents." },
  36. { GuiBitmapButtonCtrl::BitmapCentered, "Centered", "Center bitmap in control." },
  37. EndImplementEnumType;
  38. //=============================================================================
  39. // GuiBitmapButtonCtrl
  40. //=============================================================================
  41. IMPLEMENT_CONOBJECT(GuiBitmapButtonCtrl);
  42. ConsoleDocClass( GuiBitmapButtonCtrl,
  43. "@brief A button that renders its various states (mouse over, pushed, etc.) from separate bitmaps.\n\n"
  44. "A bitmapped button is a push button that uses one or more texture images for rendering its individual states.\n\n"
  45. "To find the individual textures associated with the button, a naming scheme is used. For each state "
  46. "a suffix is appended to the texture file name given in the GuiBitmapButtonCtrl::bitmap field:\n"
  47. "- \"_n\": Normal state. This one will be active when no other state applies.\n"
  48. "- \"_h\": Highlighted state. This applies when the mouse is hovering over the button.\n"
  49. "- \"_d\": Depressed state. This applies when the left mouse button has been clicked on the button but not yet released.\n"
  50. "- \"_i\": Inactive state. This applies when the button control has been deactivated (GuiControl::setActive())\n\n"
  51. "If a bitmap for a particular state cannot be found, the default bitmap will be used. To disable all state-based "
  52. "bitmap functionality, set useStates to false which will make the control solely render from the bitmap specified "
  53. "in the bitmap field.\n\n"
  54. "@section guibitmapbutton_modifiers Per-Modifier Button Actions\n"
  55. "If GuiBitmapButtonCtrl::useModifiers is set to true, per-modifier button actions and textures are enabled. This functionality "
  56. "allows to associate different images and different actions with a button depending on which modifiers are pressed "
  57. "on the keyboard by the user.\n\n"
  58. "When enabled, this functionality alters the texture lookup above by prepending the following strings to the "
  59. "suffixes listed above:\n"
  60. "- \"\": Default. No modifier is pressed.\n"
  61. "- \"_ctrl\": Image to use when CTRL/CMD is down.\n"
  62. "- \"_alt\": Image to use when ALT is down.\n"
  63. "- \"_shift\": Image to use when SHIFT is down\n\n"
  64. "When this functionality is enabled, a new set of callbacks is used:\n"
  65. "- onDefaultClick: Button was clicked without a modifier being presssed.\n"
  66. "- onCtrlClick: Button was clicked with the CTRL/CMD key down.\n"
  67. "- onAltClick: Button was clicked with the ALT key down.\n"
  68. "- onShiftClick: Button was clicked with the SHIFT key down.\n\n"
  69. "GuiControl::command or GuiControl::onAction() still work as before when per-modifier functionality is enabled.\n\n"
  70. "Note that modifiers cannot be mixed. If two or more modifiers are pressed, a single one will take precedence over "
  71. "the remaining modifiers. The order of precedence corresponds to the order listed above.\n\n"
  72. "@tsexample\n"
  73. "// Create an OK button that will trigger an onOk() call on its parent when clicked:\n"
  74. "%okButton = new GuiBitmapButtonCtrl()\n"
  75. "{\n"
  76. " bitmap = \"art/gui/okButton\";\n"
  77. " autoFitExtents = true;\n"
  78. " command = \"$ThisControl.getParent().onOk();\";\n"
  79. "};\n"
  80. "@endtsexample\n\n"
  81. "@ingroup GuiButtons"
  82. );
  83. IMPLEMENT_CALLBACK( GuiBitmapButtonCtrl, onDefaultClick, void, (), (),
  84. "Called when per-modifier functionality is enabled and the user clicks on the button without any modifier pressed.\n"
  85. "@ref guibitmapbutton_modifiers" );
  86. IMPLEMENT_CALLBACK( GuiBitmapButtonCtrl, onCtrlClick, void, (), (),
  87. "Called when per-modifier functionality is enabled and the user clicks on the button with the CTRL key pressed.\n"
  88. "@ref guibitmapbutton_modifiers" );
  89. IMPLEMENT_CALLBACK( GuiBitmapButtonCtrl, onAltClick, void, (), (),
  90. "Called when per-modifier functionality is enabled and the user clicks on the button with the ALT key pressed.\n"
  91. "@ref guibitmapbutton_modifiers" );
  92. IMPLEMENT_CALLBACK( GuiBitmapButtonCtrl, onShiftClick, void, (), (),
  93. "Called when per-modifier functionality is enabled and the user clicks on the button with the SHIFT key pressed.\n"
  94. "@ref guibitmapbutton_modifiers" );
  95. //-----------------------------------------------------------------------------
  96. GuiBitmapButtonCtrl::GuiBitmapButtonCtrl()
  97. {
  98. mBitmapMode = BitmapStretched;
  99. mAutoFitExtents = false;
  100. mUseModifiers = false;
  101. mUseStates = true;
  102. setExtent( 140, 30 );
  103. }
  104. //-----------------------------------------------------------------------------
  105. void GuiBitmapButtonCtrl::initPersistFields()
  106. {
  107. addGroup( "Bitmap" );
  108. addProtectedField( "bitmap", TypeStringFilename, Offset( mBitmapName, GuiBitmapButtonCtrl ),
  109. &_setBitmap, &defaultProtectedGetFn,
  110. "Texture file to display on this button.\n"
  111. "If useStates is false, this will be the file that renders on the control. Otherwise, this will "
  112. "specify the default texture name to which the various state and modifier suffixes are appended "
  113. "to find the per-state and per-modifier (if enabled) textures." );
  114. addField( "bitmapMode", TYPEID< BitmapMode >(), Offset( mBitmapMode, GuiBitmapButtonCtrl ),
  115. "Behavior for fitting the bitmap to the control extents.\n"
  116. "If set to 'Stretched', the bitmap will be stretched both verticall and horizontally to fit inside "
  117. "the control's extents.\n\n"
  118. "If set to 'Centered', the bitmap will stay at its original resolution centered in the control's "
  119. "rectangle (getting clipped if the control is smaller than the texture)." );
  120. addProtectedField( "autoFitExtents", TypeBool, Offset( mAutoFitExtents, GuiBitmapButtonCtrl ),
  121. &_setAutoFitExtents, &defaultProtectedGetFn,
  122. "If true, the control's extents will be set to match the bitmap's extents when setting the bitmap.\n"
  123. "The bitmap extents will always be taken from the default/normal bitmap (in case the extents of the various "
  124. "bitmaps do not match up.)" );
  125. addField( "useModifiers", TypeBool, Offset( mUseModifiers, GuiBitmapButtonCtrl ),
  126. "If true, per-modifier button functionality is enabled.\n"
  127. "@ref guibitmapbutton_modifiers" );
  128. addField( "useStates", TypeBool, Offset( mUseStates, GuiBitmapButtonCtrl ),
  129. "If true, per-mouse state button functionality is enabled.\n"
  130. "Defaults to true.\n\n"
  131. "If you do not use per-state images on this button set this to false to speed up the loading process "
  132. "by inhibiting searches for the individual images." );
  133. endGroup( "Bitmap" );
  134. Parent::initPersistFields();
  135. }
  136. //-----------------------------------------------------------------------------
  137. bool GuiBitmapButtonCtrl::onWake()
  138. {
  139. if (! Parent::onWake())
  140. return false;
  141. setActive( true );
  142. setBitmap( mBitmapName );
  143. return true;
  144. }
  145. //-----------------------------------------------------------------------------
  146. void GuiBitmapButtonCtrl::onSleep()
  147. {
  148. if( dStricmp(mBitmapName, "texhandle") != 0 )
  149. for( U32 i = 0; i < NumModifiers; ++ i )
  150. {
  151. mTextures[ i ].mTextureNormal = NULL;
  152. mTextures[ i ].mTextureHilight = NULL;
  153. mTextures[ i ].mTextureDepressed = NULL;
  154. mTextures[ i ].mTextureInactive = NULL;
  155. }
  156. Parent::onSleep();
  157. }
  158. //-----------------------------------------------------------------------------
  159. bool GuiBitmapButtonCtrl::_setAutoFitExtents( void *object, const char *index, const char *data )
  160. {
  161. GuiBitmapButtonCtrl* ctrl = reinterpret_cast< GuiBitmapButtonCtrl* >( object );
  162. ctrl->setAutoFitExtents( dAtob( data ) );
  163. return false;
  164. }
  165. //-----------------------------------------------------------------------------
  166. bool GuiBitmapButtonCtrl::_setBitmap( void *object, const char *index, const char *data )
  167. {
  168. GuiBitmapButtonCtrl* ctrl = reinterpret_cast< GuiBitmapButtonCtrl* >( object );
  169. ctrl->setBitmap( data );
  170. return false;
  171. }
  172. //-----------------------------------------------------------------------------
  173. // Legacy method. Can just assign to bitmap field.
  174. DefineEngineMethod( GuiBitmapButtonCtrl, setBitmap, void, ( const char* path ),,
  175. "Set the bitmap to show on the button.\n"
  176. "@param path Path to the texture file in any of the supported formats.\n" )
  177. {
  178. object->setBitmap( path );
  179. }
  180. //-----------------------------------------------------------------------------
  181. void GuiBitmapButtonCtrl::inspectPostApply()
  182. {
  183. Parent::inspectPostApply();
  184. Torque::Path path( mBitmapName );
  185. const String& fileName = path.getFileName();
  186. if( mUseStates )
  187. {
  188. // If the filename points to a single state, automatically
  189. // cut off the state part. Makes it easy to select files in
  190. // the editor without having to go in and manually cut off the
  191. // state parts all the time.
  192. static String s_n = "_n";
  193. static String s_d = "_d";
  194. static String s_h = "_h";
  195. static String s_i = "_i";
  196. if( fileName.endsWith( s_n )
  197. || fileName.endsWith( s_d )
  198. || fileName.endsWith( s_h )
  199. || fileName.endsWith( s_i ) )
  200. {
  201. path.setFileName( fileName.substr( 0, fileName.length() - 2 ) );
  202. path.setExtension( String::EmptyString );
  203. }
  204. }
  205. setBitmap( path.getFullPath() );
  206. // if the extent is set to (0,0) in the gui editor and appy hit, this control will
  207. // set it's extent to be exactly the size of the normal bitmap (if present)
  208. if ((getWidth() == 0) && (getHeight() == 0) && mTextures[ 0 ].mTextureNormal)
  209. {
  210. setExtent( mTextures[ 0 ].mTextureNormal->getWidth(), mTextures[ 0 ].mTextureNormal->getHeight());
  211. }
  212. }
  213. //-----------------------------------------------------------------------------
  214. void GuiBitmapButtonCtrl::setAutoFitExtents( bool state )
  215. {
  216. mAutoFitExtents = state;
  217. if( mAutoFitExtents )
  218. setBitmap( mBitmapName );
  219. }
  220. //-----------------------------------------------------------------------------
  221. void GuiBitmapButtonCtrl::setBitmap( const String& name )
  222. {
  223. PROFILE_SCOPE( GuiBitmapButtonCtrl_setBitmap );
  224. mBitmapName = name;
  225. if( !isAwake() )
  226. return;
  227. if( !mBitmapName.isEmpty() )
  228. {
  229. if( dStricmp( mBitmapName, "texhandle" ) != 0 )
  230. {
  231. const U32 count = mUseModifiers ? NumModifiers : 1;
  232. for( U32 i = 0; i < count; ++ i )
  233. {
  234. static String modifiers[] =
  235. {
  236. "",
  237. "_ctrl",
  238. "_alt",
  239. "_shift"
  240. };
  241. static String s_n = "_n";
  242. static String s_d = "_d";
  243. static String s_h = "_h";
  244. static String s_i = "_i";
  245. String baseName = mBitmapName;
  246. if( mUseModifiers )
  247. baseName += modifiers[ i ];
  248. mTextures[ i ].mTextureNormal = GFXTexHandle( baseName, &GFXDefaultPersistentProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__));
  249. if( mUseStates )
  250. {
  251. if( !mTextures[ i ].mTextureNormal )
  252. mTextures[ i ].mTextureNormal = GFXTexHandle( baseName + s_n, &GFXDefaultPersistentProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__));
  253. mTextures[ i ].mTextureHilight = GFXTexHandle( baseName + s_h, &GFXDefaultPersistentProfile, avar("%s() - mTextureHighlight (line %d)", __FUNCTION__, __LINE__));
  254. if( !mTextures[ i ].mTextureHilight )
  255. mTextures[ i ].mTextureHilight = mTextures[ i ].mTextureNormal;
  256. mTextures[ i ].mTextureDepressed = GFXTexHandle( baseName + s_d, &GFXDefaultPersistentProfile, avar("%s() - mTextureDepressed (line %d)", __FUNCTION__, __LINE__));
  257. if( !mTextures[ i ].mTextureDepressed )
  258. mTextures[ i ].mTextureDepressed = mTextures[ i ].mTextureHilight;
  259. mTextures[ i ].mTextureInactive = GFXTexHandle( baseName + s_i, &GFXDefaultPersistentProfile, avar("%s() - mTextureInactive (line %d)", __FUNCTION__, __LINE__));
  260. if( !mTextures[ i ].mTextureInactive )
  261. mTextures[ i ].mTextureInactive = mTextures[ i ].mTextureNormal;
  262. }
  263. if( i == 0 && mTextures[ i ].mTextureNormal.isNull() && mTextures[ i ].mTextureHilight.isNull() && mTextures[ i ].mTextureDepressed.isNull() && mTextures[ i ].mTextureInactive.isNull() )
  264. {
  265. Con::warnf( "GuiBitmapButtonCtrl::setBitmap - Unable to load texture: %s", mBitmapName.c_str() );
  266. this->setBitmap( GFXTextureManager::getUnavailableTexturePath() );
  267. return;
  268. }
  269. }
  270. }
  271. if( mAutoFitExtents && !mTextures[ 0 ].mTextureNormal.isNull() )
  272. setExtent( mTextures[ 0 ].mTextureNormal.getWidth(), mTextures[ 0 ].mTextureNormal.getHeight() );
  273. }
  274. else
  275. {
  276. for( U32 i = 0; i < NumModifiers; ++ i )
  277. {
  278. mTextures[ i ].mTextureNormal = NULL;
  279. mTextures[ i ].mTextureHilight = NULL;
  280. mTextures[ i ].mTextureDepressed = NULL;
  281. mTextures[ i ].mTextureInactive = NULL;
  282. }
  283. }
  284. setUpdate();
  285. }
  286. //-----------------------------------------------------------------------------
  287. void GuiBitmapButtonCtrl::setBitmapHandles(GFXTexHandle normal, GFXTexHandle highlighted, GFXTexHandle depressed, GFXTexHandle inactive)
  288. {
  289. const U32 count = mUseModifiers ? NumModifiers : 1;
  290. for( U32 i = 0; i < count; ++ i )
  291. {
  292. mTextures[ i ].mTextureNormal = normal;
  293. mTextures[ i ].mTextureHilight = highlighted;
  294. mTextures[ i ].mTextureDepressed = depressed;
  295. mTextures[ i ].mTextureInactive = inactive;
  296. if (!mTextures[ i ].mTextureHilight)
  297. mTextures[ i ].mTextureHilight = mTextures[ i ].mTextureNormal;
  298. if (!mTextures[ i ].mTextureDepressed)
  299. mTextures[ i ].mTextureDepressed = mTextures[ i ].mTextureHilight;
  300. if (!mTextures[ i ].mTextureInactive)
  301. mTextures[ i ].mTextureInactive = mTextures[ i ].mTextureNormal;
  302. if (mTextures[ i ].mTextureNormal.isNull() && mTextures[ i ].mTextureHilight.isNull() && mTextures[ i ].mTextureDepressed.isNull() && mTextures[ i ].mTextureInactive.isNull())
  303. {
  304. Con::warnf("GuiBitmapButtonCtrl::setBitmapHandles() - Invalid texture handles");
  305. setBitmap( GFXTextureManager::getUnavailableTexturePath() );
  306. return;
  307. }
  308. }
  309. mBitmapName = "texhandle";
  310. }
  311. //------------------------------------------------------------------------------
  312. GuiBitmapButtonCtrl::Modifier GuiBitmapButtonCtrl::getCurrentModifier()
  313. {
  314. U8 modifierKeys = Input::getModifierKeys();
  315. if( modifierKeys & SI_PRIMARY_CTRL )
  316. return ModifierCtrl;
  317. else if( modifierKeys & SI_PRIMARY_ALT )
  318. return ModifierAlt;
  319. else if( modifierKeys & SI_SHIFT )
  320. return ModifierShift;
  321. return ModifierNone;
  322. }
  323. //------------------------------------------------------------------------------
  324. GFXTexHandle& GuiBitmapButtonCtrl::getTextureForCurrentState()
  325. {
  326. U32 index = ModifierNone;
  327. if( mUseModifiers )
  328. index = getCurrentModifier();
  329. if( !mUseStates )
  330. {
  331. if( mTextures[ index ].mTextureNormal )
  332. return mTextures[ 0 ].mTextureNormal;
  333. else
  334. return mTextures[ index ].mTextureNormal;
  335. }
  336. switch( getState() )
  337. {
  338. case NORMAL:
  339. if( !mTextures[ index ].mTextureNormal )
  340. return mTextures[ 0 ].mTextureNormal;
  341. else
  342. return mTextures[ index ].mTextureNormal;
  343. case HILIGHT:
  344. if( !mTextures[ index ].mTextureHilight )
  345. return mTextures[ 0 ].mTextureHilight;
  346. else
  347. return mTextures[ index ].mTextureHilight;
  348. case DEPRESSED:
  349. if( !mTextures[ index ].mTextureDepressed )
  350. return mTextures[ 0 ].mTextureDepressed;
  351. else
  352. return mTextures[ index ].mTextureDepressed;
  353. default:
  354. if( !mTextures[ index ].mTextureInactive )
  355. return mTextures[ 0 ].mTextureInactive;
  356. else
  357. return mTextures[ index ].mTextureInactive;
  358. }
  359. }
  360. //------------------------------------------------------------------------------
  361. void GuiBitmapButtonCtrl::onAction()
  362. {
  363. Parent::onAction();
  364. if( mUseModifiers )
  365. {
  366. switch( getCurrentModifier() )
  367. {
  368. case ModifierNone:
  369. onDefaultClick_callback();
  370. break;
  371. case ModifierCtrl:
  372. onCtrlClick_callback();
  373. break;
  374. case ModifierAlt:
  375. onAltClick_callback();
  376. break;
  377. case ModifierShift:
  378. onShiftClick_callback();
  379. break;
  380. default:
  381. break;
  382. }
  383. }
  384. }
  385. //------------------------------------------------------------------------------
  386. void GuiBitmapButtonCtrl::onRender(Point2I offset, const RectI& updateRect)
  387. {
  388. GFXTexHandle& texture = getTextureForCurrentState();
  389. if( texture )
  390. {
  391. renderButton( texture, offset, updateRect );
  392. renderChildControls( offset, updateRect );
  393. }
  394. else
  395. Parent::onRender(offset, updateRect);
  396. }
  397. //------------------------------------------------------------------------------
  398. void GuiBitmapButtonCtrl::renderButton( GFXTexHandle &texture, const Point2I &offset, const RectI& updateRect )
  399. {
  400. GFX->getDrawUtil()->clearBitmapModulation();
  401. switch( mBitmapMode )
  402. {
  403. case BitmapStretched:
  404. {
  405. RectI rect( offset, getExtent() );
  406. GFX->getDrawUtil()->drawBitmapStretch( texture, rect );
  407. break;
  408. }
  409. case BitmapCentered:
  410. {
  411. Point2I p = offset;
  412. p.x += getExtent().x / 2 - texture.getWidth() / 2;
  413. p.y += getExtent().y / 2 - texture.getHeight() / 2;
  414. GFX->getDrawUtil()->drawBitmap( texture, p );
  415. break;
  416. }
  417. }
  418. }
  419. //=============================================================================
  420. // GuiBitmapButtonTextCtrl.
  421. //=============================================================================
  422. IMPLEMENT_CONOBJECT( GuiBitmapButtonTextCtrl);
  423. ConsoleDocClass( GuiBitmapButtonTextCtrl,
  424. "@brief An extension of GuiBitmapButtonCtrl that additionally renders a text label on the bitmapped button.\n\n"
  425. "The text for the label is taken from the GuiButtonBaseCtrl::text property.\n\n"
  426. "For rendering, the label is placed, relative to the control's upper left corner, at the text offset specified in the "
  427. "control's profile (GuiControlProfile::textOffset) and justified according to the profile's setting (GuiControlProfile::justify).\n\n"
  428. "@see GuiControlProfile::textOffset\n"
  429. "@see GuiControlProfile::justify\n"
  430. "@ingroup GuiButtons"
  431. );
  432. //-----------------------------------------------------------------------------
  433. void GuiBitmapButtonTextCtrl::renderButton( GFXTexHandle &texture, const Point2I &offset, const RectI& updateRect )
  434. {
  435. Parent::renderButton( texture, offset, updateRect );
  436. Point2I textPos = offset;
  437. if(mDepressed)
  438. textPos += Point2I(1,1);
  439. // Make sure we take the profile's textOffset into account.
  440. textPos += mProfile->mTextOffset;
  441. GFX->getDrawUtil()->setBitmapModulation( mProfile->mFontColor );
  442. renderJustifiedText(textPos, getExtent(), mButtonText);
  443. }