boot_menu.h

Go to the documentation of this file.
00001 
00002 //            Copyright (C) 2004-2007 by The Allacrost Project
00003 //                         All Rights Reserved
00004 //
00005 // This code is licensed under the GNU GPL version 2. It is free software 
00006 // and you may modify it and/or redistribute it under the terms of this license.
00007 // See http://www.gnu.org/copyleft/gpl.html for details.
00009 
00010 /*!****************************************************************************
00011  * \file    boot_menu.h
00012  * \author  Viljami Korhonen, mindflayer@allacrost.org
00013  * \brief   Header file for the boot-mode menu
00014  *
00015  * This code extends some parts of the OptionBox to match the
00016  * requirements of the boot menu. This includes features like multi-depth 
00017  * menus and custom visualization as well as custom event handling.
00018  * However, no inheritance was used as I found it to be more of a nuisance
00019  * than benefit in here!
00020  *****************************************************************************/
00021 
00022 #ifndef __BOOT_MENU__
00023 #define __BOOT_MENU__
00024 
00025 #include <string>
00026 #include <vector>
00027 
00028 #include "utils.h"
00029 #include "defs.h"
00030 
00031 #include "video.h"
00032 
00034 namespace hoa_boot {
00035 
00036 /*!****************************************************************************
00037  *  \brief The BootMenu-class will help in creation of the boot-menu.
00038  *   All of the boot-menu functions are given via function pointers to the class.
00039  *****************************************************************************/
00040 class BootMenu
00041 {
00042 public:
00043   BootMenu(BootMenu * parent = 0, bool windowed = false, BootMode * boot_mode = 0);
00044 
00045   ~BootMenu();
00046   
00055   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);
00056 
00061   void SetOptionText(uint32 index, const hoa_utils::ustring & text);
00062 
00067   void EnableOption(int32 index, bool enable);
00068 
00072   void SetWindowed(bool windowed);
00073 
00077   void SetParent(BootMenu * parent);
00078 
00082   void SetTextDensity(float density);
00083 
00087   int32 GetEvent();
00088 
00092   BootMenu * GetParent() const;
00093 
00097   bool IsWindowed() const;
00098 
00102   bool IsSelectionEnabled() const;
00103 
00105   bool Draw();
00106 
00108   void ConfirmPressed();
00109 
00111   void LeftPressed();
00112 
00114   void RightPressed();
00115 
00117   void UpPressed();
00118 
00120   void DownPressed();
00121 
00123   void CancelPressed();
00124 
00125 
00129   static void UpdateWindow(int32 frame_time);
00130 
00134   static void ShowWindow(bool toggle);
00135 
00136 
00137 private:
00139   static void _InitWindow();
00140 
00141 
00143   static BootMode * _boot_mode;
00144 
00146   BootMenu * _parent_menu;
00147 
00149   hoa_video::OptionBox _current_menu;
00150 
00151 
00153   bool _is_windowed;
00154 
00156   static hoa_video::MenuWindow * _menu_window;
00157 
00159   std::vector<void (BootMode::*)()> _confirm_handlers;
00160 
00162   std::vector<void (BootMode::*)()> _left_handlers;
00163 
00165   std::vector<void (BootMode::*)()> _right_handlers;
00166 
00168   std::vector<void (BootMode::*)()> _up_handlers;
00169 
00171   std::vector<void (BootMode::*)()> _down_handlers;
00172 
00173 }; // end class BootMenu
00174 
00175 
00176 }
00177 
00178 #endif

Generated on Fri Jul 6 23:11:11 2007 for Hero of Allacrost by  doxygen 1.5.1