_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include "stratagus.h"
#include "ui.h"
#include "actions.h"
#include "commands.h"
#include "depend.h"
#include "font.h"
#include "guichan/key.h"
#include "guichan/sdl/sdlinput.h"
#include "interface.h"
#include "map.h"
#include "player.h"
#include "settings.h"
#include "sound.h"
#include "spells.h"
#include "translate.h"
#include "trigger.h"
#include "ui/popup.h"
#include "unit.h"
#include "unittype.h"
#include "upgrade.h"
#include "video.h"
#include <ctype.h>
#include <vector>
#include <sstream>
Classes | |
struct | PopupDrawCache |
botpanel.cpp - The bottom panel. | |
ButtonAction * | LastDrawnButtonPopup |
Last drawn popup : used to speed up drawing. More... | |
int | CurrentButtonLevel |
for unit buttons sub-menus etc. More... | |
std::vector< ButtonAction * > | UnitButtonTable |
All buttons for units. More... | |
std::vector< ButtonAction > | CurrentButtons |
Pointer to current buttons. More... | |
static struct PopupDrawCache | popupCache |
void | InitButtons () |
Generate all buttons. More... | |
int | AddButton (int pos, int level, const std::string &icon_ident, ButtonCmd action, const std::string &value, void *actionCb, const ButtonCheckFunc func, const std::string &allow, const int key, const std::string &hint, const std::string &descr, const std::string &sound, const std::string &cursor, const std::string &umask, const std::string &popup, bool alwaysShow) |
Make a new button. More... | |
void | CleanButtons () |
Free memory for buttons. More... | |
static int | GetButtonStatus (const ButtonAction &button, int UnderCursor) |
static bool | CanShowPopupContent (const PopupConditionPanel *condition, const ButtonAction &button, CUnitType *type) |
static void | GetPopupSize (const CPopup &popup, const ButtonAction &button, int &popupWidth, int &popupHeight, int *Costs) |
void | DrawPopup (const ButtonAction &button, const CUIButton &uibutton, int x, int y) |
Draw the button popup. More... | |
void | UpdateStatusLineForButton (const ButtonAction &button) |
Update the status line with hints from the button. More... | |
bool | IsButtonAllowed (const CUnit &unit, const ButtonAction &buttonaction) |
static void | UpdateButtonPanelMultipleUnits (std::vector< ButtonAction > *buttonActions) |
static void | UpdateButtonPanelSingleUnit (const CUnit &unit, std::vector< ButtonAction > *buttonActions) |
int AddButton | ( | int | pos, |
int | level, | ||
const std::string & | icon_ident, | ||
ButtonCmd | action, | ||
const std::string & | value, | ||
void * | actionCb, | ||
const ButtonCheckFunc | func, | ||
const std::string & | allow, | ||
const int | key, | ||
const std::string & | hint, | ||
const std::string & | descr, | ||
const std::string & | sound, | ||
const std::string & | cursor, | ||
const std::string & | umask, | ||
const std::string & | popup, | ||
bool | alwaysShow | ||
) |
Make a new button.
FIXME: docu
|
static |
Tell if we can show the popup content. verify each sub condition for that.
condition | condition to verify. |
unit | unit that certain condition can refer. |
void CleanButtons | ( | ) |
Free memory for buttons.
Cleanup buttons.
void DrawPopup | ( | const ButtonAction & | button, |
const CUIButton & | uibutton, | ||
int | x, | ||
int | y | ||
) |
Draw the button popup.
Draw popup
|
static |
Return Status of button.
button | button to check status |
UnderCursor | Current Button Under Cursor |
FIXME : add IconDisabled when needed.
FIXME : Should show the rally action for training unit ? (NewOrder)
|
static |
void InitButtons | ( | ) |
Generate all buttons.
Initialize the buttons.
bool IsButtonAllowed | ( | const CUnit & | unit, |
const ButtonAction & | buttonaction | ||
) |
Check if the button is allowed for the unit.
unit | unit which checks for allow. |
buttonaction | button to check if it is allowed. |
FIXME: better check. (dependency, resource, ...)
FIXME: make difference with impossible and not yet researched.
|
static |
Update bottom panel for multiple units.
FIXME : make UpdateButtonPanelMultipleUnits more configurable.
show all possible buttons or just same button...
|
static |
Update bottom panel for single unit. or unit group with the same type.
unit | unit which has actions shown with buttons. |
void UpdateStatusLineForButton | ( | const ButtonAction & | button | ) |
Update the status line with hints from the button.
Update the status line with hints from the button
button | Button |
int CurrentButtonLevel |
for unit buttons sub-menus etc.
vladi: used for unit buttons sub-menus etc
std::vector<ButtonAction> CurrentButtons |
Pointer to current buttons.
ButtonAction* LastDrawnButtonPopup |
Last drawn popup : used to speed up drawing.
|
static |
std::vector<ButtonAction *> UnitButtonTable |
All buttons for units.