Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/gui-qt/sidebar.h Source File

Freeciv-3.1

Loading...
Searching...
No Matches
sidebar.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifndef FC__SIDEBAR_H
15#define FC__SIDEBAR_H
16
17// Needed for the moc-generated meta file
18#ifdef HAVE_CONFIG_H
19#include <fc_config.h>
20#endif
21
22// Qt
23#include <QEnterEvent>
24#include <QWidget>
25
26 enum { SW_STD = 0, SW_TAX = 1, SW_INDICATORS = 2 };
27
28class QPixmap;
29class QVBoxLayout;
30
31 typedef void (*pfcn_bool)(bool);
32 typedef void (*pfcn)(void);
33
34void side_blink_endturn(bool do_restore);
35void update_turn_done_tooltip();
36void side_center_unit();
37void side_disable_endturn(bool do_restore);
38void side_finish_turn(bool nothing);
39void side_indicators_menu();
40void side_rates_wdg(bool nothing);
41void side_right_click_diplomacy();
42void side_right_click_science();
43void side_left_click_science(bool nothing);
44void side_show_map(bool nothing);
45/***************************************************************************
46 Class representing single widget(icon) on sidebar
47***************************************************************************/
48 class fc_sidewidget : public QWidget
49{
50 Q_OBJECT
51public:
52 fc_sidewidget(QPixmap *pix, QString label, QString pg ,pfcn_bool func,
53 int type = SW_STD);
54 ~fc_sidewidget();
55 int get_priority();
56 QPixmap *get_pixmap();
57 void paint(QPainter *painter, QPaintEvent *event);
58 void resize_pixmap(int width, int height);
59 void set_custom_labels(QString l);
60 void set_label(QString str);
61 void set_left_click(pfcn_bool func);
62 void set_pixmap(QPixmap* pm);
63 void set_right_click(pfcn func);
64 void set_tooltip(QString tooltip);
65 void set_wheel_down(pfcn func);
66 void set_wheel_up(pfcn func);
67 void update_final_pixmap();
68 void update_fonts();
69
70 bool blink;
71 bool keep_blinking;
72 bool disabled;
73 int standard;
74 QString page;
75public slots:
76 void sblink();
77 void some_slot();
78protected:
79 void contextMenuEvent(QContextMenuEvent *event);
80#ifndef FC_QT5_MODE
81 void enterEvent(QEnterEvent *event);
82#else // FC_QT5_MODE
83 void enterEvent(QEvent *event);
84#endif // FC_QT5_MODE
85 void leaveEvent(QEvent *event);
86 void mousePressEvent(QMouseEvent *event);
87 void paintEvent(QPaintEvent *event);
88 void wheelEvent(QWheelEvent *event);
89private:
90 void paint();
91 bool hover;
92 pfcn right_click;
93 pfcn wheel_down;
94 pfcn wheel_up;
95 pfcn_bool left_click;
96 QFont *sfont;
97 QFont *info_font;
98 QPixmap *def_pixmap;
99 QPixmap *final_pixmap;
100 QPixmap *scaled_pixmap;
101 QString custom_label;
102 QString desc;
103 QTimer *timer;
104};
105
106
107/***************************************************************************
108 Freeciv sidebar
109***************************************************************************/
110 class fc_sidebar : public QWidget
111{
112 Q_OBJECT
113public:
114 fc_sidebar();
115 ~fc_sidebar();
116 void add_widget(fc_sidewidget *fsw);
117 void paint(QPainter *painter, QPaintEvent *event);
118 void resize_me(int height, bool force = false);
119 void update_fonts();
120 QList<fc_sidewidget*> objects;
121protected:
122 void paintEvent(QPaintEvent *event);
123private:
124 QVBoxLayout *layout;
125};
126
127
128#endif /* FC__SIDEBAR_H */
129
str
#define str
Definition astring.c:76
height
struct canvas int int struct sprite int int int int height
Definition canvas_g.h:44
width
struct canvas int int struct sprite int int int width
Definition canvas_g.h:44
fc_sidewidget
Definition sidebar.h:49
fc_sidewidget::update_fonts
void update_fonts()
Definition sidebar.cpp:132
fc_sidewidget::blink
bool blink
Definition sidebar.h:70
fc_sidewidget::set_wheel_down
void set_wheel_down(pfcn func)
Definition sidebar.cpp:287
fc_sidewidget::final_pixmap
QPixmap * final_pixmap
Definition sidebar.h:99
fc_sidewidget::get_priority
int get_priority()
fc_sidewidget::info_font
QFont * info_font
Definition sidebar.h:97
fc_sidewidget::wheel_down
pfcn wheel_down
Definition sidebar.h:93
fc_sidewidget::custom_label
QString custom_label
Definition sidebar.h:101
fc_sidewidget::sfont
QFont * sfont
Definition sidebar.h:96
fc_sidewidget::keep_blinking
bool keep_blinking
Definition sidebar.h:71
fc_sidewidget::~fc_sidewidget
~fc_sidewidget()
Definition sidebar.cpp:99
fc_sidewidget::wheelEvent
void wheelEvent(QWheelEvent *event)
Definition sidebar.cpp:319
fc_sidewidget::desc
QString desc
Definition sidebar.h:102
fc_sidewidget::set_wheel_up
void set_wheel_up(pfcn func)
Definition sidebar.cpp:295
fc_sidewidget::some_slot
void some_slot()
Definition sidebar.cpp:356
fc_sidewidget::contextMenuEvent
void contextMenuEvent(QContextMenuEvent *event)
Definition sidebar.cpp:258
fc_sidewidget::wheel_up
pfcn wheel_up
Definition sidebar.h:94
fc_sidewidget::def_pixmap
QPixmap * def_pixmap
Definition sidebar.h:98
fc_sidewidget::paintEvent
void paintEvent(QPaintEvent *event)
Definition sidebar.cpp:204
fc_sidewidget::paint
void paint()
fc_sidewidget::page
QString page
Definition sidebar.h:74
fc_sidewidget::set_custom_labels
void set_custom_labels(QString l)
Definition sidebar.cpp:152
fc_sidewidget::standard
int standard
Definition sidebar.h:73
fc_sidewidget::mousePressEvent
void mousePressEvent(QMouseEvent *event)
Definition sidebar.cpp:303
fc_sidewidget::set_left_click
void set_left_click(pfcn_bool func)
Definition sidebar.cpp:271
fc_sidewidget::set_label
void set_label(QString str)
Definition sidebar.cpp:176
fc_sidewidget::sblink
void sblink()
Definition sidebar.cpp:335
fc_sidewidget::hover
bool hover
Definition sidebar.h:91
fc_sidewidget::set_pixmap
void set_pixmap(QPixmap *pm)
Definition sidebar.cpp:120
fc_sidewidget::resize_pixmap
void resize_pixmap(int width, int height)
Definition sidebar.cpp:185
fc_sidewidget::timer
QTimer * timer
Definition sidebar.h:103
fc_sidewidget::set_right_click
void set_right_click(pfcn func)
Definition sidebar.cpp:279
fc_sidewidget::disabled
bool disabled
Definition sidebar.h:72
fc_sidewidget::set_tooltip
void set_tooltip(QString tooltip)
Definition sidebar.cpp:160
fc_sidewidget::leaveEvent
void leaveEvent(QEvent *event)
Definition sidebar.cpp:244
fc_sidewidget::left_click
pfcn_bool left_click
Definition sidebar.h:95
fc_sidewidget::enterEvent
void enterEvent(QEnterEvent *event)
Definition sidebar.cpp:228
fc_sidewidget::update_final_pixmap
void update_final_pixmap()
Definition sidebar.cpp:393
fc_sidewidget::scaled_pixmap
QPixmap * scaled_pixmap
Definition sidebar.h:100
fc_sidewidget::get_pixmap
QPixmap * get_pixmap()
Definition sidebar.cpp:168
fc_sidewidget::right_click
pfcn right_click
Definition sidebar.h:92
event
enum event_type event
Definition events.c:81
tooltip
const char * tooltip
Definition repodlgs.c:1314
type
GType type
Definition repodlgs.c:1312
func
get_token_fn_t func
Definition inputfile.c:128
slots
struct player_slot * slots
Definition player.c:50
side_center_unit
void side_center_unit()
Definition sidebar.cpp:650
side_show_map
void side_show_map(bool nothing)
Definition sidebar.cpp:624
update_turn_done_tooltip
void update_turn_done_tooltip()
Definition gui_main.c:1055
side_indicators_menu
void side_indicators_menu()
Definition sidebar.cpp:702
side_left_click_science
void side_left_click_science(bool nothing)
Definition sidebar.cpp:809
side_rates_wdg
void side_rates_wdg(bool nothing)
Definition sidebar.cpp:640
pfcn_bool
void(* pfcn_bool)(bool)
Definition sidebar.h:31
pfcn
void(* pfcn)(void)
Definition sidebar.h:32
side_right_click_diplomacy
void side_right_click_diplomacy()
Definition sidebar.cpp:716
SW_TAX
@ SW_TAX
Definition sidebar.h:26
SW_INDICATORS
@ SW_INDICATORS
Definition sidebar.h:26
SW_STD
@ SW_STD
Definition sidebar.h:26
side_finish_turn
void side_finish_turn(bool nothing)
Definition sidebar.cpp:632
side_right_click_science
void side_right_click_science()
Definition sidebar.cpp:760
side_blink_endturn
void side_blink_endturn(bool do_restore)
Definition sidebar.cpp:690
side_disable_endturn
void side_disable_endturn(bool do_restore)
Definition sidebar.cpp:677
bool
#define bool
Definition support.h:61