5 void puButton::draw ( int dx, int dy )
7 if ( !visible ) return ;
9 /* If button is pushed or highlighted - use inverse style for button itself */
13 if ( parent && ( ( parent->getType() & PUCLASS_POPUPMENU ) ||
14 ( parent->getType() & PUCLASS_MENUBAR ) ) )
15 tempStyle = ( getValue() ^ highlighted ) ? PUSTYLE_SMALL_SHADED : style ;
17 tempStyle = ( getValue() ^ highlighted ) ? -style : style ;
19 abox . draw ( dx, dy, tempStyle, colour, isReturnDefault() ) ;
21 /* If greyed out then halve the opacity when drawing the label and legend */
24 glColor4fv ( colour [ PUCOL_LEGEND ] ) ;
26 glColor4f ( colour [ PUCOL_LEGEND ][0],
27 colour [ PUCOL_LEGEND ][1],
28 colour [ PUCOL_LEGEND ][2],
29 colour [ PUCOL_LEGEND ][3] / 2.0f ) ; /* 50% more transparent */
31 int xx = ( abox.max[0] - abox.min[0] - puGetStringWidth(legendFont,legend) ) / 2 ;
32 int yy = ( abox.max[1] - abox.min[1] - puGetStringHeight(legendFont) ) / 2 ;
34 puDrawString ( legendFont, legend,
35 dx + abox.min[0] + xx,
36 dy + abox.min[1] + yy ) ;
38 draw_label ( dx, dy ) ;
42 void puButton::doHit ( int button, int updown, int, int )
46 if ( button == PU_LEFT_BUTTON )
48 if ( updown == active_mouse_edge || active_mouse_edge == PU_UP_AND_DOWN )
51 setValue ( (int) ! getValue () ) ;