hoa_boot::BootMenu Class Reference

The BootMenu-class will help in creation of the boot-menu. All of the boot-menu functions are given via function pointers to the class. More...

#include <boot_menu.h>

Collaboration diagram for hoa_boot::BootMenu:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void AddOption (const hoa_utils::ustring &text, void(BootMode::*confirm_function)()=0, void(BootMode::*left_function)()=0, void(BootMode::*right_function)()=0, void(BootMode::*up_function)()=0, void(BootMode::*down_function)()=0)
 Adds a new menu option with the desired function attached to it.
 BootMenu (BootMenu *parent=0, bool windowed=false, BootMode *boot_mode=0)
void CancelPressed ()
 Handles the cancel key.
void ConfirmPressed ()
 Handles the confirm key.
void DownPressed ()
 Handles the down key.
bool Draw ()
 Draws menu on the screen.
void EnableOption (int32 index, bool enable)
 Enables or disables the option with the given index.
int32 GetEvent ()
 Updates menu events. Call this every frame just like you would do on OptionBox!
BootMenuGetParent () const
 Returns parent of the menu.
bool IsSelectionEnabled () const
 Returns true if the currently selected option is enabled and a confirm handler is available.
bool IsWindowed () const
 Returns boolean if the menu is windowed or not.
void LeftPressed ()
 Handles the left key.
void RightPressed ()
 Handles the right key.
void SetOptionText (uint32 index, const hoa_utils::ustring &text)
 Changes text of the option.
void SetParent (BootMenu *parent)
 Sets a new parent for this menu.
void SetTextDensity (float density)
 Sets new text density.
void SetWindowed (bool windowed)
 Toggles this menu to be windowed (or not windowed).
void UpPressed ()
 Handles the up key.
 ~BootMenu ()

Static Public Member Functions

static void ShowWindow (bool toggle)
 Shows or hides the menu window.
static void UpdateWindow (int32 frame_time)
 Updates the menu window.

Static Private Member Functions

static void _InitWindow ()
 Inits the menu window, called in the constructor of the class.

Private Attributes

std::vector< void(BootMode::*)()> _confirm_handlers
 confirm-key handlers for all options in the menu
hoa_video::OptionBox _current_menu
 OptionBox displayed on the screen.
std::vector< void(BootMode::*)()> _down_handlers
 down-key handlers for all options in the menu
bool _is_windowed
 Is this menu windowed (and thus vertically aligned) or not.
std::vector< void(BootMode::*)()> _left_handlers
 left-key handlers for all options in the menu
BootMenu_parent_menu
 A pointer to the parent menu (or 0 for the root menu).
std::vector< void(BootMode::*)()> _right_handlers
 right-key handlers for all options in the menu
std::vector< void(BootMode::*)()> _up_handlers
 up-key handlers for all options in the menu

Static Private Attributes

static BootMode_boot_mode
 A pointer to the boot mode.
static hoa_video::MenuWindow_menu_window
 A window needed by some menus.

Detailed Description

The BootMenu-class will help in creation of the boot-menu. All of the boot-menu functions are given via function pointers to the class.

****************************************************************************

Definition at line 40 of file boot_menu.h.


Constructor & Destructor Documentation

hoa_boot::BootMenu::BootMenu ( BootMenu parent = 0,
bool  windowed = false,
BootMode boot_mode = 0 
)

Definition at line 28 of file boot_menu.cpp.

References _boot_mode, _InitWindow(), _is_windowed, and SetWindowed().

Here is the call graph for this function:

hoa_boot::BootMenu::~BootMenu (  ) 

Definition at line 43 of file boot_menu.cpp.

References _menu_window, and hoa_video::MenuWindow::Destroy().

Here is the call graph for this function:


Member Function Documentation

void hoa_boot::BootMenu::_InitWindow (  )  [static, private]

Inits the menu window, called in the constructor of the class.

Definition at line 296 of file boot_menu.cpp.

References _menu_window, hoa_video::MenuWindow::Create(), hoa_video::MenuWindow::Hide(), hoa_video::MenuWindow::SetDisplayMode(), hoa_video::private_video::GUIElement::SetPosition(), and hoa_video::VIDEO_MENU_EXPAND_FROM_CENTER.

Referenced by BootMenu().

Here is the call graph for this function:

void hoa_boot::BootMenu::AddOption ( const hoa_utils::ustring text,
void(BootMode::*)()  confirm_function = 0,
void(BootMode::*)()  left_function = 0,
void(BootMode::*)()  right_function = 0,
void(BootMode::*)()  up_function = 0,
void(BootMode::*)()  down_function = 0 
)

Adds a new menu option with the desired function attached to it.

Parameters:
text A text representing the new option
*confirm_function 'Confirm' handler from the BootMode
*left_function 'Left' handler from the BootMode
*right_function 'Right' handler from the BootMode
*up_function 'Up' handler from the BootMode
*down_function 'Down' handler from the BootMode

Definition at line 55 of file boot_menu.cpp.

References _confirm_handlers, _current_menu, _down_handlers, _is_windowed, _left_handlers, _right_handlers, _up_handlers, hoa_video::OptionBox::AddOption(), hoa_video::OptionBox::GetNumberOptions(), hoa_video::OptionBox::SetSelection(), and hoa_video::OptionBox::SetSize().

Referenced by hoa_boot::BootMode::_SetupAudioOptionsMenu(), hoa_boot::BootMode::_SetupJoySetttingsMenu(), hoa_boot::BootMode::_SetupKeySetttingsMenu(), hoa_boot::BootMode::_SetupMainMenu(), hoa_boot::BootMode::_SetupOptionsMenu(), hoa_boot::BootMode::_SetupResolutionMenu(), and hoa_boot::BootMode::_SetupVideoOptionsMenu().

Here is the call graph for this function:

void hoa_boot::BootMenu::CancelPressed (  ) 

Handles the cancel key.

Definition at line 271 of file boot_menu.cpp.

References _current_menu, and hoa_video::OptionBox::HandleCancelKey().

Referenced by hoa_boot::BootMode::Update().

Here is the call graph for this function:

void hoa_boot::BootMenu::ConfirmPressed (  ) 

Handles the confirm key.

Definition at line 186 of file boot_menu.cpp.

References _boot_mode, _confirm_handlers, _current_menu, hoa_video::OptionBox::GetSelection(), and hoa_video::OptionBox::HandleConfirmKey().

Referenced by hoa_boot::BootMode::Update().

Here is the call graph for this function:

void hoa_boot::BootMenu::DownPressed (  ) 

Handles the down key.

Definition at line 254 of file boot_menu.cpp.

References _boot_mode, _current_menu, _down_handlers, hoa_video::OptionBox::GetSelection(), and hoa_video::OptionBox::HandleDownKey().

Referenced by hoa_boot::BootMode::Update().

Here is the call graph for this function:

bool hoa_boot::BootMenu::Draw (  ) 

Draws menu on the screen.

Definition at line 173 of file boot_menu.cpp.

References _current_menu, _menu_window, hoa_video::OptionBox::Draw(), hoa_video::MenuWindow::Draw(), hoa_video::GameVideo::EnableScissoring(), and hoa_video::VideoManager.

Referenced by hoa_boot::BootMode::Draw().

Here is the call graph for this function:

void hoa_boot::BootMenu::EnableOption ( int32  index,
bool  enable 
)

Enables or disables the option with the given index.

Parameters:
index index of the option to be disabled
enable enable or disable the option

Definition at line 86 of file boot_menu.cpp.

References _current_menu, and hoa_video::OptionBox::EnableOption().

Referenced by hoa_boot::BootMode::_SetupOptionsMenu(), and hoa_boot::BootMode::_SetupVideoOptionsMenu().

Here is the call graph for this function:

int32 hoa_boot::BootMenu::GetEvent (  ) 

Updates menu events. Call this every frame just like you would do on OptionBox!

Returns:
The event code from OptionBox::GetEvent()

Definition at line 143 of file boot_menu.cpp.

References _current_menu, hoa_video::OptionBox::GetEvent(), and hoa_video::OptionBox::Update().

Referenced by hoa_boot::BootMode::Update().

Here is the call graph for this function:

BootMenu * hoa_boot::BootMenu::GetParent (  )  const

Returns parent of the menu.

Returns:
Parent of the menu (or 0 for the root menu)

Definition at line 151 of file boot_menu.cpp.

References _parent_menu.

Referenced by hoa_boot::BootMode::Update().

bool hoa_boot::BootMenu::IsSelectionEnabled (  )  const

Returns true if the currently selected option is enabled and a confirm handler is available.

Definition at line 165 of file boot_menu.cpp.

References _confirm_handlers, _current_menu, hoa_video::OptionBox::GetSelection(), and hoa_video::OptionBox::IsEnabled().

Referenced by hoa_boot::BootMode::Update().

Here is the call graph for this function:

bool hoa_boot::BootMenu::IsWindowed (  )  const

Returns boolean if the menu is windowed or not.

Returns:
True if windowed. False if not

Definition at line 158 of file boot_menu.cpp.

References _is_windowed.

Referenced by hoa_boot::BootMode::Update().

void hoa_boot::BootMenu::LeftPressed (  ) 

Handles the left key.

Definition at line 203 of file boot_menu.cpp.

References _boot_mode, _current_menu, _left_handlers, hoa_video::OptionBox::GetSelection(), and hoa_video::OptionBox::HandleLeftKey().

Referenced by hoa_boot::BootMode::Update().

Here is the call graph for this function:

void hoa_boot::BootMenu::RightPressed (  ) 

Handles the right key.

Definition at line 220 of file boot_menu.cpp.

References _boot_mode, _current_menu, _right_handlers, hoa_video::OptionBox::GetSelection(), and hoa_video::OptionBox::HandleRightKey().

Referenced by hoa_boot::BootMode::Update().

Here is the call graph for this function:

void hoa_boot::BootMenu::SetOptionText ( uint32  index,
const hoa_utils::ustring text 
)

Changes text of the option.

Parameters:
index index of the text to be changed
text new text for the option

Definition at line 80 of file boot_menu.cpp.

References _current_menu, and hoa_video::OptionBox::SetOptionText().

Referenced by hoa_boot::BootMode::_UpdateAudioOptions(), hoa_boot::BootMode::_UpdateJoySettings(), hoa_boot::BootMode::_UpdateKeySettings(), and hoa_boot::BootMode::_UpdateVideoOptions().

Here is the call graph for this function:

void hoa_boot::BootMenu::SetParent ( BootMenu parent  ) 

Sets a new parent for this menu.

Parameters:
parent Pointer to the new parent

Definition at line 126 of file boot_menu.cpp.

References _parent_menu.

Referenced by hoa_boot::BootMode::_SetupAudioOptionsMenu(), hoa_boot::BootMode::_SetupJoySetttingsMenu(), hoa_boot::BootMode::_SetupKeySetttingsMenu(), hoa_boot::BootMode::_SetupOptionsMenu(), hoa_boot::BootMode::_SetupResolutionMenu(), and hoa_boot::BootMode::_SetupVideoOptionsMenu().

void hoa_boot::BootMenu::SetTextDensity ( float  density  ) 

Sets new text density.

Parameters:
density A new density value

Definition at line 133 of file boot_menu.cpp.

References _current_menu, _is_windowed, and hoa_video::OptionBox::SetCellSize().

Referenced by hoa_boot::BootMode::_SetupJoySetttingsMenu(), and hoa_boot::BootMode::_SetupKeySetttingsMenu().

Here is the call graph for this function:

void hoa_boot::BootMenu::SetWindowed ( bool  windowed  ) 

Toggles this menu to be windowed (or not windowed).

Parameters:
windowed true == enable windowing

Definition at line 93 of file boot_menu.cpp.

References _current_menu, _is_windowed, _menu_window, hoa_video::OptionBox::GetNumberOptions(), hoa_video::private_video::GUIElement::SetAlignment(), hoa_video::OptionBox::SetCellSize(), hoa_video::OptionBox::SetCursorOffset(), hoa_video::OptionBox::SetFont(), hoa_video::OptionBox::SetHorizontalWrapMode(), hoa_video::OptionBox::SetOptionAlignment(), hoa_video::private_video::GUIControl::SetOwner(), hoa_video::private_video::GUIElement::SetPosition(), hoa_video::OptionBox::SetSelectMode(), hoa_video::OptionBox::SetSize(), hoa_video::OptionBox::SetVerticalWrapMode(), hoa_video::VIDEO_SELECT_SINGLE, hoa_video::VIDEO_WRAP_MODE_STRAIGHT, hoa_video::VIDEO_X_CENTER, hoa_video::VIDEO_X_LEFT, and hoa_video::VIDEO_Y_CENTER.

Referenced by hoa_boot::BootMode::_SetupAudioOptionsMenu(), hoa_boot::BootMode::_SetupJoySetttingsMenu(), hoa_boot::BootMode::_SetupKeySetttingsMenu(), hoa_boot::BootMode::_SetupOptionsMenu(), hoa_boot::BootMode::_SetupResolutionMenu(), hoa_boot::BootMode::_SetupVideoOptionsMenu(), and BootMenu().

Here is the call graph for this function:

void hoa_boot::BootMenu::ShowWindow ( bool  toggle  )  [static]

Shows or hides the menu window.

Parameters:
toggle menu window on or off

Definition at line 286 of file boot_menu.cpp.

References _menu_window, hoa_video::MenuWindow::Hide(), and hoa_video::MenuWindow::Show().

Referenced by hoa_boot::BootMode::Update().

Here is the call graph for this function:

void hoa_boot::BootMenu::UpdateWindow ( int32  frame_time  )  [static]

Updates the menu window.

Parameters:
frameTime time of the frame in ms

Definition at line 278 of file boot_menu.cpp.

References _menu_window, and hoa_video::MenuWindow::Update().

Referenced by hoa_boot::BootMode::Update().

Here is the call graph for this function:

void hoa_boot::BootMenu::UpPressed (  ) 

Handles the up key.

Definition at line 237 of file boot_menu.cpp.

References _boot_mode, _current_menu, _up_handlers, hoa_video::OptionBox::GetSelection(), and hoa_video::OptionBox::HandleUpKey().

Referenced by hoa_boot::BootMode::Update().

Here is the call graph for this function:


Member Data Documentation

BootMode * hoa_boot::BootMenu::_boot_mode [static, private]

A pointer to the boot mode.

Definition at line 143 of file boot_menu.h.

Referenced by BootMenu(), ConfirmPressed(), DownPressed(), LeftPressed(), RightPressed(), and UpPressed().

std::vector<void (BootMode::*)()> hoa_boot::BootMenu::_confirm_handlers [private]

confirm-key handlers for all options in the menu

Definition at line 159 of file boot_menu.h.

Referenced by AddOption(), ConfirmPressed(), and IsSelectionEnabled().

hoa_video::OptionBox hoa_boot::BootMenu::_current_menu [private]

OptionBox displayed on the screen.

Definition at line 149 of file boot_menu.h.

Referenced by AddOption(), CancelPressed(), ConfirmPressed(), DownPressed(), Draw(), EnableOption(), GetEvent(), IsSelectionEnabled(), LeftPressed(), RightPressed(), SetOptionText(), SetTextDensity(), SetWindowed(), and UpPressed().

std::vector<void (BootMode::*)()> hoa_boot::BootMenu::_down_handlers [private]

down-key handlers for all options in the menu

Definition at line 171 of file boot_menu.h.

Referenced by AddOption(), and DownPressed().

bool hoa_boot::BootMenu::_is_windowed [private]

Is this menu windowed (and thus vertically aligned) or not.

Definition at line 153 of file boot_menu.h.

Referenced by AddOption(), BootMenu(), IsWindowed(), SetTextDensity(), and SetWindowed().

std::vector<void (BootMode::*)()> hoa_boot::BootMenu::_left_handlers [private]

left-key handlers for all options in the menu

Definition at line 162 of file boot_menu.h.

Referenced by AddOption(), and LeftPressed().

hoa_video::MenuWindow * hoa_boot::BootMenu::_menu_window [static, private]

A window needed by some menus.

Definition at line 156 of file boot_menu.h.

Referenced by _InitWindow(), Draw(), SetWindowed(), ShowWindow(), UpdateWindow(), and ~BootMenu().

BootMenu* hoa_boot::BootMenu::_parent_menu [private]

A pointer to the parent menu (or 0 for the root menu).

Definition at line 146 of file boot_menu.h.

Referenced by GetParent(), and SetParent().

std::vector<void (BootMode::*)()> hoa_boot::BootMenu::_right_handlers [private]

right-key handlers for all options in the menu

Definition at line 165 of file boot_menu.h.

Referenced by AddOption(), and RightPressed().

std::vector<void (BootMode::*)()> hoa_boot::BootMenu::_up_handlers [private]

up-key handlers for all options in the menu

Definition at line 168 of file boot_menu.h.

Referenced by AddOption(), and UpPressed().


The documentation for this class was generated from the following files:
Generated on Fri Jul 6 23:13:22 2007 for Hero of Allacrost by  doxygen 1.5.1