_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

Classes
botpanel.cpp File Reference
#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.

ButtonActionLastDrawnButtonPopup
 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< ButtonActionCurrentButtons
 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)
 

Function Documentation

◆ AddButton()

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

◆ CanShowPopupContent()

static bool CanShowPopupContent ( const PopupConditionPanel condition,
const ButtonAction button,
CUnitType type 
)
static

Tell if we can show the popup content. verify each sub condition for that.

Parameters
conditioncondition to verify.
unitunit that certain condition can refer.
Returns
0 if we can't show the content, else 1.

◆ CleanButtons()

void CleanButtons ( )

Free memory for buttons.

Cleanup buttons.

◆ DrawPopup()

void DrawPopup ( const ButtonAction button,
const CUIButton uibutton,
int  x,
int  y 
)

Draw the button popup.

Draw popup

◆ GetButtonStatus()

static int GetButtonStatus ( const ButtonAction button,
int  UnderCursor 
)
static

Return Status of button.

Parameters
buttonbutton to check status
UnderCursorCurrent Button Under Cursor
Returns
status of button
Icon(Active | Selected | Clicked | AutoCast | Disabled).
Todo:

FIXME : add IconDisabled when needed.

FIXME : Should show the rally action for training unit ? (NewOrder)

◆ GetPopupSize()

static void GetPopupSize ( const CPopup popup,
const ButtonAction button,
int &  popupWidth,
int &  popupHeight,
int *  Costs 
)
static

◆ InitButtons()

void InitButtons ( )

Generate all buttons.

Initialize the buttons.

◆ IsButtonAllowed()

bool IsButtonAllowed ( const CUnit unit,
const ButtonAction buttonaction 
)

Check if the button is allowed for the unit.

Parameters
unitunit which checks for allow.
buttonactionbutton to check if it is allowed.
Returns
1 if button is allowed, 0 else.
Todo:

FIXME: better check. (dependency, resource, ...)

FIXME: make difference with impossible and not yet researched.

◆ UpdateButtonPanelMultipleUnits()

static void UpdateButtonPanelMultipleUnits ( std::vector< ButtonAction > *  buttonActions)
static

Update bottom panel for multiple units.

Returns
array of UI.ButtonPanel.NumButtons buttons to show.
Todo:

FIXME : make UpdateButtonPanelMultipleUnits more configurable.

show all possible buttons or just same button...

◆ UpdateButtonPanelSingleUnit()

static void UpdateButtonPanelSingleUnit ( const CUnit unit,
std::vector< ButtonAction > *  buttonActions 
)
static

Update bottom panel for single unit. or unit group with the same type.

Parameters
unitunit which has actions shown with buttons.
Returns
array of UI.ButtonPanel.NumButtons buttons to show.
Todo:
FIXME : Remove Hack for cancel button.

◆ UpdateStatusLineForButton()

void UpdateStatusLineForButton ( const ButtonAction button)

Update the status line with hints from the button.

Update the status line with hints from the button

Parameters
buttonButton

Variable Documentation

◆ CurrentButtonLevel

int CurrentButtonLevel

for unit buttons sub-menus etc.

vladi: used for unit buttons sub-menus etc

◆ CurrentButtons

std::vector<ButtonAction> CurrentButtons

Pointer to current buttons.

◆ LastDrawnButtonPopup

ButtonAction* LastDrawnButtonPopup

Last drawn popup : used to speed up drawing.

◆ popupCache

struct PopupDrawCache popupCache
static

◆ UnitButtonTable

std::vector<ButtonAction *> UnitButtonTable

All buttons for units.

(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.