![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
Top bar widget that shows the amount of gold owned by the current player, and their income. More...
#include <top_bar.h>
Inheritance diagram for gold_widget:
Collaboration diagram for gold_widget:Public Types | |
| enum class | warning { no_warning = 0 , losing_money = 1 , low_on_funds = 2 } |
| Types of warnings displayed by gold_widget. More... | |
Public Member Functions | |
| gold_widget () | |
| Constructor. More... | |
| ~gold_widget () override | |
| Destructor. More... | |
| int | income () const |
| Returns the incom as currently shown. More... | |
| void | set_income (int income) |
| Changes the gold amount shown by the widget. More... | |
| int | gold () const |
| Returns the gold amount as currently shown. More... | |
| void | set_gold (int gold) |
| Changes the gold amount shown by the widget. More... | |
| warning | current_warning () const |
| Retrieves the current warning. More... | |
Public Member Functions inherited from top_bar_widget | |
| top_bar_widget (const QString &label, const QString &pg, pfcn func) | |
| Sidewidget constructor. More... | |
| ~top_bar_widget () override | |
| Sidewidget destructor. More... | |
| int | getPriority () |
| QPixmap * | get_pixmap () |
| void | paint (QPainter *painter, QPaintEvent *event) |
| void | setCustomLabels (const QString &) |
| Sets custom text visible on top of sidewidget. More... | |
| void | setLabel (const QString &str) |
| void | setLeftClick (pfcn func) |
| Sets callback for mouse left click. More... | |
| void | setRightClick (pfcn func) |
| Sets callback for mouse right click. More... | |
| void | setWheelDown (pfcn func) |
| Sets callback for mouse wheel down. More... | |
| void | setWheelUp (pfcn func) |
| Sets callback for mouse wheel up. More... | |
Protected Member Functions | |
| void | paintEvent (QPaintEvent *event) override |
| Renders the national budget widget. More... | |
Protected Member Functions inherited from top_bar_widget | |
| void | mousePressEvent (QMouseEvent *event) override |
| Mouse press event for sidewidget. More... | |
| void | paintEvent (QPaintEvent *event) override |
| Paint event for top bar widget. More... | |
| void | wheelEvent (QWheelEvent *event) override |
| Mouse wheel event. More... | |
Properties | |
| warning | current_warning |
Private Member Functions | |
| void | update_contents () |
| Updates the displayed text after the gold or income changed. More... | |
Private Attributes | |
| int | m_gold = 0 |
| int | m_income = 0 |
| warning | m_warning = warning::no_warning |
Additional Inherited Members | |
Public Slots inherited from top_bar_widget | |
| void | sblink () |
| Blinks current top_bar widget. More... | |
| void | someSlot () |
| Miscelanous slot, helping observe players currently, and changing science extra functionality might be added, eg by setting properties. More... | |
Public Attributes inherited from top_bar_widget | |
| bool | blink |
| bool | keep_blinking |
| QString | page |
Top bar widget that shows the amount of gold owned by the current player, and their income.
The top bar widget displays a warning when the player has negative income or will go bankrupt.
|
strong |
Types of warnings displayed by gold_widget.
| Enumerator | |
|---|---|
| no_warning | Used when no warning is shown. |
| losing_money | The current player has negative gold income. |
| low_on_funds | The current player will soon go bankrupt. |
| gold_widget::gold_widget | ( | ) |
Constructor.
Definition at line 360 of file top_bar.cpp.
|
override |
Destructor.
Definition at line 370 of file top_bar.cpp.
|
inline |
|
inline |
Returns the gold amount as currently shown.
Definition at line 136 of file top_bar.h.
Referenced by set_gold().
|
inline |
Returns the incom as currently shown.
Definition at line 126 of file top_bar.h.
Referenced by set_income(), and update_contents().
|
overrideprotected |
Renders the national budget widget.
Definition at line 407 of file top_bar.cpp.
|
inline |
Changes the gold amount shown by the widget.
Definition at line 139 of file top_bar.h.
Referenced by pageGame::updateInfoLabelTimeout().
|
inline |
Changes the gold amount shown by the widget.
Definition at line 129 of file top_bar.h.
Referenced by pageGame::updateInfoLabelTimeout().
|
private |
Updates the displayed text after the gold or income changed.
Definition at line 375 of file top_bar.cpp.
Referenced by set_gold(), and set_income().
|
private |
Definition at line 154 of file top_bar.h.
Referenced by gold(), income(), set_gold(), and update_contents().
|
private |
Definition at line 154 of file top_bar.h.
Referenced by set_income(), and update_contents().
|
private |
Definition at line 155 of file top_bar.h.
Referenced by current_warning(), and update_contents().