/* ParaGUI - crossplatform widgetset Copyright (C) 2000,2001,2002 Alexander Pipelka This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Alexander Pipelka pipelka@teleweb.at Last Update: $Author: braindead $ Update Date: $Date: 2003/01/04 21:13:37 $ Source File: $Source: /cvsroot/paragui/paragui/include/pgmenubar.h,v $ CVS/RCS Revision: $Revision: 1.3.6.2 $ Status: $State: Exp $ */ #ifndef PG_MENUBAR_H #define PG_MENUBAR_H #ifdef SWIG %include "swigcommon.h" %module pgmenubar %{ #include "pgmenubar.h" %} #endif #include "pgthemewidget.h" #include "pgbutton.h" #include "pgpopupmenu.h" #include "pgeventobject.h" /** @author Alexander Pipelka @short A menubar. This class provides a MenuBar where you can snap in different PG_PopupMenu objects. Every item creates a button in the bar. By clicking the button the corresponding PopupMenu is opened. */ class DECLSPEC PG_MenuBar : public PG_ThemeWidget, public PG_EventObject { public: /** Creates a new MenuBar object. @param parent pointer to the parent widget @param rect the position of the menubar @param style the default themestyle (MenuBar) The constructor creates a new MenuBar object without any items. Use the Add member function to insert PG_PopupMenu objects. */ PG_MenuBar(PG_Widget* parent, const PG_Rect& rect, const char* style = "MenuBar"); /** Destroys the MenuBar object. */ ~PG_MenuBar(); /** Add a new item to the MenuBar @param text label of the new item @param menu pointer to the PG_PopupMenu object to add @param indent offset of pixels to the last item @param width width of the MenuBar button (if 0 the button will fit the textsize) */ void Add(const char* text, PG_PopupMenu* menu, Uint16 indent = 5, Uint16 width = 0); protected: //! Internal item typedef struct { PG_Button* button; //!< pointer to the PG_Button object showed in the bar PG_PopupMenu* popupmenu; //!< pointer to the linked PG_PopupMenu object } MenuBarItem; vector ItemList; Uint16 my_btnOffsetY; private: /** Callback handler for MSG_BUTTONCLICK messages */ PARAGUI_CALLBACK(handle_button); void Cleanup(); string my_style; PG_PopupMenu* my_active; }; #endif // PG_MENUBAR_H