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
26enum { SW_STD = 0, SW_TAX = 1, SW_INDICATORS = 2 };
27
28class QPixmap;
29class QVBoxLayout;
30
31typedef void (*pfcn_bool)(bool);
32typedef void (*pfcn)(void);
33
34void side_blink_endturn(bool do_restore);
36void side_center_unit();
37void side_disable_endturn(bool do_restore);
38void side_finish_turn(bool nothing);
40void side_rates_wdg(bool nothing);
43void side_left_click_science(bool nothing);
44void side_show_map(bool nothing);
45/***************************************************************************
46 Class representing single widget(icon) on sidebar
47***************************************************************************/
48class 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);
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);
62 void set_pixmap(QPixmap* pm);
64 void set_tooltip(QString tooltip);
68 void update_fonts();
69
70 bool blink;
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;
96 QFont *sfont;
97 QFont *info_font;
98 QPixmap *def_pixmap;
99 QPixmap *final_pixmap;
102 QString desc;
103 QTimer *timer;
104};
105
106
107/***************************************************************************
108 Freeciv sidebar
109***************************************************************************/
110class 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
#define str
Definition astring.c:76
struct canvas int int struct sprite int int int int height
Definition canvas_g.h:44
struct canvas int int struct sprite int int int width
Definition canvas_g.h:44
QVBoxLayout * layout
Definition sidebar.h:124
void resize_me(int height, bool force=false)
Definition sidebar.cpp:570
void add_widget(fc_sidewidget *fsw)
Definition sidebar.cpp:537
QList< fc_sidewidget * > objects
Definition sidebar.h:120
void update_fonts()
Definition sidebar.cpp:613
void paintEvent(QPaintEvent *event)
Definition sidebar.cpp:547
void paint(QPainter *painter, QPaintEvent *event)
Definition sidebar.cpp:559
void update_fonts()
Definition sidebar.cpp:132
void set_wheel_down(pfcn func)
Definition sidebar.cpp:287
QPixmap * final_pixmap
Definition sidebar.h:99
int get_priority()
QFont * info_font
Definition sidebar.h:97
pfcn wheel_down
Definition sidebar.h:93
QString custom_label
Definition sidebar.h:101
QFont * sfont
Definition sidebar.h:96
bool keep_blinking
Definition sidebar.h:71
void wheelEvent(QWheelEvent *event)
Definition sidebar.cpp:319
QString desc
Definition sidebar.h:102
void set_wheel_up(pfcn func)
Definition sidebar.cpp:295
void some_slot()
Definition sidebar.cpp:356
void contextMenuEvent(QContextMenuEvent *event)
Definition sidebar.cpp:258
pfcn wheel_up
Definition sidebar.h:94
QPixmap * def_pixmap
Definition sidebar.h:98
void paintEvent(QPaintEvent *event)
Definition sidebar.cpp:204
QString page
Definition sidebar.h:74
void set_custom_labels(QString l)
Definition sidebar.cpp:152
void mousePressEvent(QMouseEvent *event)
Definition sidebar.cpp:303
void set_left_click(pfcn_bool func)
Definition sidebar.cpp:271
void set_label(QString str)
Definition sidebar.cpp:176
void sblink()
Definition sidebar.cpp:335
void set_pixmap(QPixmap *pm)
Definition sidebar.cpp:120
void resize_pixmap(int width, int height)
Definition sidebar.cpp:185
QTimer * timer
Definition sidebar.h:103
void set_right_click(pfcn func)
Definition sidebar.cpp:279
bool disabled
Definition sidebar.h:72
void set_tooltip(QString tooltip)
Definition sidebar.cpp:160
void leaveEvent(QEvent *event)
Definition sidebar.cpp:244
pfcn_bool left_click
Definition sidebar.h:95
void enterEvent(QEnterEvent *event)
Definition sidebar.cpp:228
void update_final_pixmap()
Definition sidebar.cpp:393
QPixmap * scaled_pixmap
Definition sidebar.h:100
QPixmap * get_pixmap()
Definition sidebar.cpp:168
pfcn right_click
Definition sidebar.h:92
enum event_type event
Definition events.c:81
const char * tooltip
Definition repodlgs.c:1314
GType type
Definition repodlgs.c:1312
get_token_fn_t func
Definition inputfile.c:128
struct player_slot * slots
Definition player.c:50
void side_center_unit()
Definition sidebar.cpp:650
void side_show_map(bool nothing)
Definition sidebar.cpp:624
void update_turn_done_tooltip()
Definition gui_main.c:1055
void side_indicators_menu()
Definition sidebar.cpp:702
void side_left_click_science(bool nothing)
Definition sidebar.cpp:809
void side_rates_wdg(bool nothing)
Definition sidebar.cpp:640
void(* pfcn_bool)(bool)
Definition sidebar.h:31
void(* pfcn)(void)
Definition sidebar.h:32
void side_right_click_diplomacy()
Definition sidebar.cpp:716
@ SW_TAX
Definition sidebar.h:26
@ SW_INDICATORS
Definition sidebar.h:26
@ SW_STD
Definition sidebar.h:26
void side_finish_turn(bool nothing)
Definition sidebar.cpp:632
void side_right_click_science()
Definition sidebar.cpp:760
void side_blink_endturn(bool do_restore)
Definition sidebar.cpp:690
void side_disable_endturn(bool do_restore)
Definition sidebar.cpp:677
#define bool
Definition support.h:61