Main Page | Class Hierarchy | Class List | File List | Class Members

Flu_Helpers.h

00001 // $Id: Flu_Helpers.h,v 1.6 2004/07/14 21:10:04 jbryan Exp $
00002 
00003 /***************************************************************
00004  *                FLU - FLTK Utility Widgets 
00005  *  Copyright (C) 2002 Ohio Supercomputer Center, Ohio State University
00006  *
00007  * This file and its content is protected by a software license.
00008  * You should have received a copy of this license with this file.
00009  * If not, please contact the Ohio Supercomputer Center immediately:
00010  * Attn: Jason Bryan Re: FLU 1224 Kinnear Rd, Columbus, Ohio 43212
00011  * 
00012  ***************************************************************/
00013 
00014 
00015 
00016 #ifndef _FLU_HELPERS_H
00017 #define _FLU_HELPERS_H
00018 
00019 #include <FL/Fl.H>
00020 #include <FL/Fl_Window.H>
00021 #include <FL/Fl_Button.H>
00022 #include <FL/Fl_Valuator.H>
00023 #include <FL/Fl_Menu_.H>
00024 #include <FL/Fl_Menu_Item.H>
00025 #include "FLU/Flu_Enumerations.h"
00026 
00027 /* Convenience routine to hide all open windows. This will (eventually) cause FLTK to exit() */
00028 inline static void fl_exit()
00029 { while( Fl::first_window() ) Fl::first_window()->hide(); }
00030 
00031 /* Return the index of the full menu entry 'fullname' in the menu 'menu', or
00032    -1 if 'fullname' does not exist in 'menu'.
00033 */
00034 FLU_EXPORT int fl_Full_Find_In_Menu( const Fl_Menu_* menu, const char* fullname );
00035 inline int fl_Full_Find_In_Menu( const Fl_Menu_& menu, const char* fullname )
00036 { return fl_Full_Find_In_Menu( &menu, fullname ); }
00037 
00038 /* Return the menu item at the full menu entry 'fullname' in the menu 'menu', or
00039    NULL if 'fullname' does not exist in 'menu'.
00040 */
00041 inline const Fl_Menu_Item *fl_Full_Find_Item_In_Menu( const Fl_Menu_* menu, const char* fullname )
00042 {
00043   int index = fl_Full_Find_In_Menu( menu, fullname );
00044   return (index != -1) ? &(((Fl_Menu_Item*)menu->menu())[index]) : 0;
00045 }
00046 inline const Fl_Menu_Item *fl_Full_Find_Item_In_Menu( const Fl_Menu_& menu, const char* fullname )
00047 { return fl_Full_Find_Item_In_Menu( &menu, fullname ); }
00048 
00049 /* Return the index of the menu entry 'name' in the menu 'menu', or
00050    -1 if 'name' does not exist in 'menu'.
00051 */
00052 FLU_EXPORT int fl_Find_In_Menu( const Fl_Menu_* menu, const char* name );
00053 inline int fl_Find_In_Menu( const Fl_Menu_& menu, const char* name )
00054 { return fl_Find_In_Menu( &menu, name ); }
00055 
00056 /* Convenience callback for an Fl_Widget to show an Fl_Window. "arg" MUST be a descendent of Fl_Window */
00057 inline static void fl_Show_Window_Callback( Fl_Widget* w, void* arg )
00058 { ((Fl_Window*)arg)->show(); }
00059 
00060 /* Convenience callback for an Fl_Widget to hide an Fl_Window. "arg" MUST be a descendent of Fl_Window */
00061 inline static void fl_Hide_Window_Callback( Fl_Widget* w, void* arg )
00062 { ((Fl_Window*)arg)->hide(); }
00063 
00064 /* Convenience callback for an Fl_Widget to hide an Fl_Window. "arg" MUST be a descendent of Fl_Window.
00065    Before the window is hidden, its user_data() field is set to the widget that invoked the callback.
00066    The user_data() can then be used to determine which widget closed the window.
00067 */
00068 inline static void fl_Hide_Window_And_Set_User_Data_Callback( Fl_Widget* w, void* arg )
00069 { ((Fl_Window*)arg)->user_data( w ); ((Fl_Window*)arg)->hide(); }
00070 
00071 /* Convenience callback to get the value of an Fl_Button and store it (as an int) into "arg". ONLY use this for an Fl_Button and "arg" MUST point to an int. */
00072 inline static void fl_Get_Button_Value_Callback( Fl_Widget* w, void* arg )
00073 { *((int*)arg) = ((Fl_Button*)w)->value(); }
00074 
00075 /* Convenience callback to get the value of an Fl_Valuator and store it (as a float) into "arg". ONLY use this for an Fl_Valuator and "arg" MUST point to a float. */
00076 inline static void fl_Get_Valuator_Value_Callback( Fl_Widget* w, void* arg )
00077 { *((float*)arg) = ((Fl_Valuator*)w)->value(); }
00078 
00079 #endif

Generated on Fri Nov 5 12:41:32 2004 for FLTK Utility Library and Widget Collection (FLU) by doxygen 1.3.5