4 void drop_down_the_menu ( puObject *b )
6 puPopupMenu *p = (puPopupMenu *) b -> getUserData () ;
8 if ( b -> getValue () )
13 for ( puObject *child = b -> getParent () -> getFirstChild () ;
14 child != NULL ; child = child -> next )
16 if (( child -> getType() & PUCLASS_BUTTON ) != 0 && child != b ) child -> clrValue () ;
17 if (( child -> getType() & PUCLASS_POPUPMENU ) != 0 && child != p ) child -> hide () ;
21 void puMenuBar::add_submenu ( char *str, char *items[], puCallback cb[] )
26 puOneShot *b = new puOneShot ( w+10, 0, str ) ;
27 b -> setStyle ( PUSTYLE_SPECIAL_UNDERLINED ) ;
28 b -> setColourScheme ( colour[PUCOL_FOREGROUND][0],
29 colour[PUCOL_FOREGROUND][1],
30 colour[PUCOL_FOREGROUND][2],
31 colour[PUCOL_FOREGROUND][3] ) ;
32 b -> setCallback ( drop_down_the_menu ) ;
33 b -> setActiveDirn ( PU_UP_AND_DOWN ) ;
35 puPopupMenu *p = new puPopupMenu ( w+10, 0 ) ;
37 b -> setUserData ( p ) ;
39 for ( int i = 0 ; items[i] != NULL ; i++ )
40 p -> add_item ( items[i], cb[i] ) ;
46 void puMenuBar::close (void)
48 puInterface::close () ;
57 Use alternate objects - which gets the puOneShot/puPopupMenu pairs
60 for ( ob = dlist ; ob != NULL ; ob = ob -> next )
64 /* Reposition the button so it looks nice */
66 ob -> getSize ( &w, &h ) ;
67 ob -> setPosition ( width, 0 ) ;
70 /* Reposition the submenu so it sits under the button */
73 ob -> getSize ( &w2, &h2 ) ;
74 ob -> setPosition ( width, -h2 ) ;