Freeciv-3.2: fc_sidewidget Class Reference

Freeciv-3.2

Loading...
Searching...
No Matches
Public Slots | Public Member Functions | Data Fields | Protected Member Functions | Private Member Functions | Private Attributes
fc_sidewidget Class Reference

`#include <sidebar.h>`

Inheritance diagram for fc_sidewidget:

## Public Slots

void | sblink ()
void | some_slot ()

## Public Member Functions

| fc_sidewidget (QPixmap *pix, QString label, QString pg, pfcn_bool func, int type=SW_STD)
| ~fc_sidewidget ()
int | get_priority ()
QPixmap * | get_pixmap ()
void | paint (QPainter *painter, QPaintEvent *event)
void | resize_pixmap (int width, int height)
void | set_custom_labels (QString l)
void | set_label (QString str)
void | set_left_click (pfcn_bool func)
void | set_pixmap (QPixmap *pm)
void | set_right_click (pfcn func)
void | set_tooltip (QString tooltip)
void | set_wheel_down (pfcn func)
void | set_wheel_up (pfcn func)
void | update_final_pixmap ()
void | update_fonts ()

## Data Fields

bool | blink
bool | keep_blinking
bool | disabled
int | standard
QString | page

## Protected Member Functions

void | contextMenuEvent (QContextMenuEvent *event)
void | enterEvent (QEnterEvent *event)
void | leaveEvent (QEvent *event)
void | mousePressEvent (QMouseEvent *event)
void | paintEvent (QPaintEvent *event)
void | wheelEvent (QWheelEvent *event)

## Private Member Functions

void | paint ()

## Private Attributes

bool | hover
pfcn | right_click
pfcn | wheel_down
pfcn | wheel_up
pfcn_bool | left_click
QFont * | sfont
QFont * | info_font
QPixmap * | def_pixmap
QPixmap * | final_pixmap
QPixmap * | scaled_pixmap
QString | custom_label
QString | desc
QTimer * | timer

## Detailed Description

Definition at line 49 of file sidebar.h.

## Constructor & Destructor Documentation

## ◆ fc_sidewidget()

fc_sidewidget::fc_sidewidget | ( | QPixmap * | pix,
|  | QString | label,
|  | QString | pg,
|  | pfcn_bool | func,
|  | int | type = `SW_STD`
| ) |  |

Sidewidget constructor

Definition at line 62 of file sidebar.cpp.

## ◆ ~fc_sidewidget()

fc_sidewidget::~fc_sidewidget | ( |  | ) |

Sidewidget destructor

Definition at line 99 of file sidebar.cpp.

## Member Function Documentation

## ◆ contextMenuEvent()

void fc_sidewidget::contextMenuEvent | ( | QContextMenuEvent * | event | ) |

protected

Context menu requested

Definition at line 258 of file sidebar.cpp.

## ◆ enterEvent()

void fc_sidewidget::enterEvent | ( | QEnterEvent * | event | ) |

protected

Mouse entered on widget area

Definition at line 228 of file sidebar.cpp.

## ◆ get_pixmap()

QPixmap * fc_sidewidget::get_pixmap | ( |  | ) |

Returns scaled (not default) pixmap for sidewidget

Definition at line 168 of file sidebar.cpp.

Referenced by fc_sidebar::resize_me().

## ◆ get_priority()

int fc_sidewidget::get_priority | ( |  | ) |

## ◆ leaveEvent()

void fc_sidewidget::leaveEvent | ( | QEvent * | event | ) |

protected

Mouse left widget area

Definition at line 244 of file sidebar.cpp.

## ◆ mousePressEvent()

void fc_sidewidget::mousePressEvent | ( | QMouseEvent * | event | ) |

protected

Mouse press event for sidewidget

Definition at line 303 of file sidebar.cpp.

## ◆ paint() [1/2]

void fc_sidewidget::paint | ( |  | ) |

private

Referenced by paintEvent().

## ◆ paint() [2/2]

void fc_sidewidget::paint | ( | QPainter * | painter,
|  | QPaintEvent * | event
| ) |  |

Paints final pixmap on screeen

Definition at line 216 of file sidebar.cpp.

## ◆ paintEvent()

void fc_sidewidget::paintEvent | ( | QPaintEvent * | event | ) |

protected

Paint event for sidewidget

Definition at line 204 of file sidebar.cpp.

## ◆ resize_pixmap()

void fc_sidewidget::resize_pixmap | ( | int | width,
|  | int | height
| ) |  |

Resizes default_pixmap to scaled_pixmap to fit current width, leaves default_pixmap unchanged

Definition at line 185 of file sidebar.cpp.

Referenced by fc_sidebar::resize_me().

## ◆ sblink

void fc_sidewidget::sblink | ( |  | ) |

slot

Blinks current sidebar widget

Definition at line 335 of file sidebar.cpp.

Referenced by fc_sidewidget().

## ◆ set_custom_labels()

void fc_sidewidget::set_custom_labels | ( | QString | l | ) |

Sets custom text visible on top of sidewidget

Definition at line 152 of file sidebar.cpp.

Referenced by fc_client::update_info_label().

## ◆ set_label()

void fc_sidewidget::set_label | ( | QString | str | ) |

Sets default label on bottom of sidewidget

Definition at line 176 of file sidebar.cpp.

## ◆ set_left_click()

void fc_sidewidget::set_left_click | ( | pfcn_bool | func | ) |

Sets callback for mouse left click

Definition at line 271 of file sidebar.cpp.

## ◆ set_pixmap()

void fc_sidewidget::set_pixmap | ( | QPixmap * | pm | ) |

Sets default pixmap for sidewidget

Definition at line 120 of file sidebar.cpp.

Referenced by fc_client::reload_sidebar_icons().

## ◆ set_right_click()

void fc_sidewidget::set_right_click | ( | pfcn | func | ) |

Sets callback for mouse right click

Definition at line 279 of file sidebar.cpp.

Referenced by fc_client::create_game_page().

## ◆ set_tooltip()

void fc_sidewidget::set_tooltip | ( | QString | tooltip | ) |

Sets tooltip for sidewidget

Definition at line 160 of file sidebar.cpp.

Referenced by fc_client::update_sidebar_tooltips().

## ◆ set_wheel_down()

void fc_sidewidget::set_wheel_down | ( | pfcn | func | ) |

Sets callback for mouse wheel down

Definition at line 287 of file sidebar.cpp.

Referenced by fc_client::create_game_page().

## ◆ set_wheel_up()

void fc_sidewidget::set_wheel_up | ( | pfcn | func | ) |

Sets callback for mouse wheel up

Definition at line 295 of file sidebar.cpp.

Referenced by fc_client::create_game_page().

## ◆ some_slot

void fc_sidewidget::some_slot | ( |  | ) |

slot

Miscelanous slot, helping observe players currently, and changing science extra functionality might be added, eg by setting properties

Definition at line 356 of file sidebar.cpp.

Referenced by side_right_click_diplomacy(), and side_right_click_science().

## ◆ update_final_pixmap()

void fc_sidewidget::update_final_pixmap | ( |  | ) |

Updates final pixmap and draws it on screen

Definition at line 393 of file sidebar.cpp.

Referenced by contextMenuEvent(), fc_game_tab_widget::current_changed(), leaveEvent(), fc_sidebar::resize_me(), sblink(), fc_sidebar::update_fonts(), and fc_client::update_info_label().

## ◆ update_fonts()

void fc_sidewidget::update_fonts | ( |  | ) |

Update sidebar fonts

Definition at line 132 of file sidebar.cpp.

Referenced by fc_sidewidget(), and fc_sidebar::update_fonts().

## ◆ wheelEvent()

void fc_sidewidget::wheelEvent | ( | QWheelEvent * | event | ) |

protected

Mouse wheel event

Definition at line 319 of file sidebar.cpp.

## Field Documentation

## ◆ blink

bool fc_sidewidget::blink

Definition at line 71 of file sidebar.h.

Referenced by fc_sidewidget(), sblink(), and update_final_pixmap().

## ◆ custom_label

QString fc_sidewidget::custom_label

private

Definition at line 102 of file sidebar.h.

Referenced by set_custom_labels(), and update_final_pixmap().

## ◆ def_pixmap

QPixmap* fc_sidewidget::def_pixmap

private

Definition at line 99 of file sidebar.h.

Referenced by fc_sidewidget(), resize_pixmap(), set_pixmap(), and ~fc_sidewidget().

## ◆ desc

QString fc_sidewidget::desc

private

Definition at line 103 of file sidebar.h.

Referenced by fc_sidewidget(), set_label(), and update_final_pixmap().

## ◆ disabled

bool fc_sidewidget::disabled

Definition at line 73 of file sidebar.h.

Referenced by fc_sidewidget(), and update_final_pixmap().

## ◆ final_pixmap

QPixmap* fc_sidewidget::final_pixmap

private

Definition at line 100 of file sidebar.h.

Referenced by fc_sidewidget(), paint(), update_final_pixmap(), and ~fc_sidewidget().

## ◆ hover

bool fc_sidewidget::hover

private

Definition at line 92 of file sidebar.h.

Referenced by contextMenuEvent(), fc_sidewidget(), leaveEvent(), and update_final_pixmap().

## ◆ info_font

QFont* fc_sidewidget::info_font

private

Definition at line 98 of file sidebar.h.

Referenced by fc_sidewidget(), update_final_pixmap(), update_fonts(), and ~fc_sidewidget().

## ◆ keep_blinking

bool fc_sidewidget::keep_blinking

Definition at line 72 of file sidebar.h.

Referenced by sblink().

## ◆ left_click

pfcn_bool fc_sidewidget::left_click

private

Definition at line 96 of file sidebar.h.

Referenced by fc_sidewidget(), mousePressEvent(), and set_left_click().

## ◆ page

QString fc_sidewidget::page

Definition at line 75 of file sidebar.h.

Referenced by fc_sidewidget(), and update_final_pixmap().

## ◆ right_click

pfcn fc_sidewidget::right_click

private

Definition at line 93 of file sidebar.h.

Referenced by fc_sidewidget(), mousePressEvent(), and set_right_click().

## ◆ scaled_pixmap

QPixmap* fc_sidewidget::scaled_pixmap

private

Definition at line 101 of file sidebar.h.

Referenced by fc_sidewidget(), get_pixmap(), resize_pixmap(), update_final_pixmap(), and ~fc_sidewidget().

## ◆ sfont

QFont* fc_sidewidget::sfont

private

Definition at line 97 of file sidebar.h.

Referenced by fc_sidewidget(), update_final_pixmap(), update_fonts(), and ~fc_sidewidget().

## ◆ standard

int fc_sidewidget::standard

Definition at line 74 of file sidebar.h.

Referenced by fc_sidewidget(), fc_sidebar::resize_me(), resize_pixmap(), and update_final_pixmap().

## ◆ timer

QTimer* fc_sidewidget::timer

private

Definition at line 104 of file sidebar.h.

Referenced by ~fc_sidewidget().

## ◆ wheel_down

pfcn fc_sidewidget::wheel_down

private

Definition at line 94 of file sidebar.h.

Referenced by fc_sidewidget(), set_wheel_down(), and wheelEvent().

## ◆ wheel_up

pfcn fc_sidewidget::wheel_up

private

Definition at line 95 of file sidebar.h.

Referenced by fc_sidewidget(), set_wheel_up(), and wheelEvent().