____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
A futuristic real-time strategy game.
This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project.
Distributed under the "GNU General Public License"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <vector>
#include <sstream>
#include "stratagus.h"
#include "unit.h"
#include "unittype.h"
#include "upgrade.h"
#include "interface.h"
#include "ui.h"
#include "player.h"
#include "spells.h"
#include "sound.h"
#include "map.h"
#include "commands.h"
#include "video.h"
#include "font.h"
#include "guichan/key.h"
#include "guichan/sdl/sdlinput.h"
Go to the source code of this file.
Functions | |
| void | InitButtons (void) |
| < Generate all buttons | |
| int | AddButton (int pos, int level, const std::string &icon_ident, ButtonCmd action, const std::string &value, const ButtonCheckFunc func, const std::string &allow, const std::string &hint, const std::string &umask) |
| void | CleanButtons (void) |
| Make a new button. | |
| static int | GetButtonStatus (const ButtonAction *button) |
| static void | DrawPopup () |
| void | UpdateStatusLineForButton (const ButtonAction *button) |
| Draw the Pie Menu. | |
| static bool | IsButtonAllowed (const CUnit *unit, const ButtonAction *buttonaction) |
| static ButtonAction * | UpdateButtonPanelMultipleUnits (void) |
| static ButtonAction * | UpdateButtonPanelSingleUnit (const CUnit *unit) |
Variables | |
| int | CurrentButtonLevel |
| < for unit buttons sub-menus etc. | |
| std::vector< ButtonAction * > | UnitButtonTable |
| Pointer to current buttons. | |
| ButtonAction * | CurrentButtons |
| Current Selected Buttons. | |
Definition in file botpanel.cpp.
| int AddButton | ( | int | pos, | |
| int | level, | |||
| const std::string & | icon_ident, | |||
| ButtonCmd | action, | |||
| const std::string & | value, | |||
| const ButtonCheckFunc | func, | |||
| const std::string & | allow, | |||
| const std::string & | hint, | |||
| const std::string & | umask | |||
| ) |
Add a button
Definition at line 99 of file botpanel.cpp.
References _C_, ButtonAction::Action, ButtonAction::Allowed, ButtonAction::AllowStr, Assert, ButtonBuild, ButtonSpellCast, ButtonTrain, DebugPrint, GetHotKey(), ButtonAction::Hint, ButtonAction::Icon, ButtonAction::Key, ButtonAction::Level, IconConfig::Name, ButtonAction::Pos, SpellType::Slot, SpellTypeByIdent(), UnitButtonTable, ButtonAction::UnitMask, UnitTypeIdByIdent(), ButtonAction::Value, and ButtonAction::ValueStr.
Referenced by CclDefineButton().
| void CleanButtons | ( | void | ) |
Make a new button.
Cleanup buttons.
Definition at line 163 of file botpanel.cpp.
References Assert, CurrentButtonLevel, int(), and UnitButtonTable.
Referenced by CleanModules().
| static void DrawPopup | ( | ) | [static] |
Draw popup
Definition at line 299 of file botpanel.cpp.
References ButtonAction::Action, ARMOR_INDEX, ATTACKRANGE_INDEX, BASICDAMAGE_INDEX, ButtonBuild, CUserInterface::ButtonPanel, CButtonPanel::Buttons, ButtonTrain, ButtonUnderCursor, CUnitType::CanAttack, ColorBlack, CYCLES_PER_SECOND, CGraphic::DrawFrameClip(), CVideo::DrawHLine(), CVideo::DrawRectangle(), CVideo::FillRectangle(), CResourceInfo::G, GetDefaultTextColors(), ButtonAction::Hint, HP_INDEX, CResourceInfo::IconFrame, CVideo::MapRGB(), MaxCosts, CUnitType::Name, PIERCINGDAMAGE_INDEX, CUnitType::ProductionCosts, RADAR_INDEX, CUserInterface::Resources, SetDefaultTextColors(), SIGHTRANGE_INDEX, SmallFont, TheScreen, UI, UnitTypes, CVariable::Value, ButtonAction::Value, CUnitType::Variable, Video, VideoDrawNumber(), VideoDrawText(), CVideo::Width, CFont::Width(), CUIButton::X, CUIButton::Y, and y.
Referenced by CButtonPanel::Draw().
| static int GetButtonStatus | ( | const ButtonAction * | button | ) | [static] |
Return Status of button.
| button | button to check status |
Icon(Active | Selected | Clicked | AutoCast | Disabled).
Definition at line 188 of file botpanel.cpp.
References ButtonAction::Action, Assert, AutoCastSpell(), AutoRepair(), ButtonAreaButton, ButtonAreaUnderCursor, ButtonAttack, ButtonAttackGround, ButtonHarvest, ButtonMove, ButtonPatrol, ButtonRepair, ButtonSpellCast, ButtonStandGround, ButtonStop, ButtonUnderCursor, IconActive, IconAutoCast, IconClicked, IconSelected, LeftButton, MouseButtons, NumSelected, ButtonAction::Pos, Selected, UnitActionAttack, UnitActionAttackGround, UnitActionBuild, UnitActionFollow, UnitActionMove, UnitActionNone, UnitActionPatrol, UnitActionRepair, UnitActionResource, UnitActionStandGround, UnitActionStill, and ButtonAction::Value.
Referenced by CButtonPanel::Draw().
| void InitButtons | ( | void | ) |
< Generate all buttons
Initialize the buttons.
Definition at line 82 of file botpanel.cpp.
References int(), and UnitButtonTable.
Referenced by CreateGame(), and InitModules().
| static bool IsButtonAllowed | ( | const CUnit * | unit, | |
| const ButtonAction * | buttonaction | |||
| ) | [static] |
Check if the button is allowed for the unit.
| unit | unit which checks for allow. | |
| buttonaction | button to check if it is allowed. |
Definition at line 510 of file botpanel.cpp.
References ButtonAction::Action, ButtonAction::Allowed, Assert, CUnit::BoardCount, ButtonAttack, ButtonAttackGround, ButtonBuild, ButtonButton, ButtonCancel, ButtonCancelBuild, ButtonCancelTrain, ButtonCheckAttack(), ButtonHarvest, ButtonMove, ButtonPatrol, ButtonRepair, ButtonSpellCast, ButtonStandGround, ButtonStop, ButtonTrain, ButtonUnload, CanMove(), CUnitType::CanTransport, CUnitType::GroundAttack, CUnit::Orders, CUnit::Player, CUnitType::RepairRange, Selected, SpellIsAvailable(), CUnit::Type, UnitActionBuilt, UnitActionTrain, and ButtonAction::Value.
Referenced by UpdateButtonPanelMultipleUnits(), and UpdateButtonPanelSingleUnit().
| static ButtonAction* UpdateButtonPanelMultipleUnits | ( | void | ) | [static] |
Update bottom panel for multiple units.
Definition at line 584 of file botpanel.cpp.
References Assert, CUserInterface::ButtonPanel, CButtonPanel::Buttons, CurrentButtonLevel, int(), IsButtonAllowed(), NumSelected, ButtonAction::Pos, Selected, UI, and UnitButtonTable.
Referenced by CButtonPanel::Update().
| static ButtonAction* UpdateButtonPanelSingleUnit | ( | const CUnit * | unit | ) | [static] |
Update bottom panel for single unit. or unit group with the same type.
| unit | unit which has actions shown with buttons. |
Definition at line 638 of file botpanel.cpp.
References Assert, CUserInterface::ButtonPanel, CButtonPanel::Buttons, CurrentButtonLevel, CUnitType::Ident, int(), IsButtonAllowed(), ButtonAction::Level, CUnit::Orders, ButtonAction::Pos, CUnit::Type, UI, UnitActionBuilt, UnitButtonTable, and ButtonAction::UnitMask.
Referenced by CButtonPanel::Update().
| void UpdateStatusLineForButton | ( | const ButtonAction * | button | ) |
Draw the Pie Menu.
Update the status line with hints from the button
| button | Button |
Definition at line 477 of file botpanel.cpp.
References ButtonAction::Action, Assert, ButtonBuild, ButtonSpellCast, ButtonTrain, ClearCosts(), ButtonAction::Hint, CStatusLine::Set(), SetCosts(), SpellTypeTable, CUserInterface::StatusLine, UI, UnitTypes, and ButtonAction::Value.
Referenced by CButtonPanel::Draw(), and DrawPieMenu().
< for unit buttons sub-menus etc.
Time to detect double clicks.
All buttons for units
Definition at line 70 of file botpanel.cpp.
Referenced by CancelBuildingMode(), CleanButtons(), CButtonPanel::DoClicked(), DoSelectionButtons(), SelectionChanged(), SendCommand(), UiFindIdleWorker(), UIHandleButtonUp(), UISelectStateButtonDown(), UpdateButtonPanelMultipleUnits(), and UpdateButtonPanelSingleUnit().
Current Selected Buttons.
Definition at line 73 of file botpanel.cpp.
Referenced by DrawPieMenu(), HandleMouseOn(), and HandlePieMenuMouseSelection().
| std::vector<ButtonAction *> UnitButtonTable |
Pointer to current buttons.
Definition at line 72 of file botpanel.cpp.
Referenced by AddButton(), CleanButtons(), InitAiHelper(), InitButtons(), UpdateButtonPanelMultipleUnits(), and UpdateButtonPanelSingleUnit().
1.5.6