mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
add fitButtonToString
This commit is contained in:
parent
50d49e534f
commit
ac6a51dfc7
2 changed files with 19 additions and 0 deletions
|
@ -385,6 +385,23 @@ getFormRefcon()
|
||||||
XP_ASSERT( ptr != 0L );
|
XP_ASSERT( ptr != 0L );
|
||||||
return (void*)ptr;
|
return (void*)ptr;
|
||||||
} /* getFormRefcon */
|
} /* getFormRefcon */
|
||||||
|
|
||||||
|
void
|
||||||
|
fitButtonToString( XP_U16 id )
|
||||||
|
{
|
||||||
|
ControlPtr button = getActiveObjectPtr( id );
|
||||||
|
const char* label = CtlGetLabel( button );
|
||||||
|
XP_U16 width = FntCharsWidth( label, XP_STRLEN(label) );
|
||||||
|
RectangleType rect;
|
||||||
|
width += 14; /* 7 pixels at either end */
|
||||||
|
|
||||||
|
getObjectBounds( id, &rect );
|
||||||
|
rect.topLeft.x -= (rect.extent.x - width);
|
||||||
|
rect.extent.x = width;
|
||||||
|
|
||||||
|
setObjectBounds( id, &rect );
|
||||||
|
} /* fitButtonToString */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined FEATURE_REALLOC || defined XW_FEATURE_UTILS
|
#if defined FEATURE_REALLOC || defined XW_FEATURE_UTILS
|
||||||
|
|
|
@ -72,6 +72,8 @@ XP_Bool penInGadget( EventPtr event, UInt16* whichGadget );
|
||||||
|
|
||||||
void setFormRefcon( void* refcon );
|
void setFormRefcon( void* refcon );
|
||||||
void* getFormRefcon();
|
void* getFormRefcon();
|
||||||
|
void fitButtonToString( XP_U16 id );
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void logEvent( eventsEnum eType );
|
void logEvent( eventsEnum eType );
|
||||||
|
|
Loading…
Reference in a new issue