Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

PG_MenuBar Class Reference

A menubar. More...

#include <pgmenubar.h>

Inheritance diagram for PG_MenuBar:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 PG_MenuBar (PG_Widget *parent, const PG_Rect &rect=PG_Rect::null, const std::string &style="MenuBar")
 Creates a new MenuBar object.
 ~PG_MenuBar ()
 Destroys the MenuBar object.
void Add (const std::string &text, PG_PopupMenu *menu, Uint16 indent=5, Uint16 width=0)
 Add a new item to the MenuBar.

Protected Member Functions

bool leaveButton (PG_Pointer last)
bool enterButton (PG_Pointer last)

Protected Attributes

std::vector< MenuBarItem * > ItemList
Uint16 my_btnOffsetY

Classes

struct  MenuBarItem
 Internal item. More...

Detailed Description

A menubar.

Author:
Alexander Pipelka
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.

Definition at line 49 of file pgmenubar.h.


Constructor & Destructor Documentation

PG_MenuBar::PG_MenuBar PG_Widget parent,
const PG_Rect rect = PG_Rect::null,
const std::string &  style = "MenuBar"
 

Creates a new MenuBar object.

Parameters:
parent pointer to the parent widget
rect the position of the menubar
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.

Definition at line 8 of file pgmenubar.cpp.

References my_btnOffsetY.

PG_MenuBar::~PG_MenuBar  ) 
 

Destroys the MenuBar object.

Definition at line 14 of file pgmenubar.cpp.


Member Function Documentation

void PG_MenuBar::Add const std::string &  text,
PG_PopupMenu menu,
Uint16  indent = 5,
Uint16  width = 0
 

Add a new item to the MenuBar.

Parameters:
text label of the new item
menu pointer to the PG_PopupMenu object to add
indent offset of pixels to the last item
width width of the MenuBar button (if 0 the button will fit the textsize)

Definition at line 18 of file pgmenubar.cpp.

References PG_MenuBar::MenuBarItem::button, enterButton(), PG_Widget::GetFontSize(), PG_Widget::getHotkeyModifier(), PG_Widget::GetTextSize(), ItemList, leaveButton(), my_btnOffsetY, PG_Rect::my_height, PG_Rect::my_xpos, PG_Rect::PG_Rect(), PG_Button::SetBehaviour(), PG_Widget::SetFontSize(), PG_Button::sigClick, PG_Button::SIGNALONCLICK, and PG_PopupMenu::sigSelectMenuItem.

bool PG_MenuBar::enterButton PG_Pointer  last  )  [protected]
 

Definition at line 86 of file pgmenubar.cpp.

References PG_MenuBar::MenuBarItem::button, and PG_Application::GetEventSupplier().

Referenced by Add().

bool PG_MenuBar::leaveButton PG_Pointer  last  )  [protected]
 

Definition at line 73 of file pgmenubar.cpp.

References PG_MenuBar::MenuBarItem::button, PG_Widget::Hide(), PG_Widget::IsMouseInside(), and PG_PopupMenu::trackMenu().

Referenced by Add().


Member Data Documentation

std::vector<MenuBarItem*> PG_MenuBar::ItemList [protected]
 

Definition at line 86 of file pgmenubar.h.

Referenced by Add().

Uint16 PG_MenuBar::my_btnOffsetY [protected]
 

Definition at line 88 of file pgmenubar.h.

Referenced by Add(), and PG_MenuBar().


The documentation for this class was generated from the following files:
Generated on Tue Jun 24 02:19:05 2008 for Advanced Strategic Command by  doxygen 1.4.2