Freeciv-3.2: choice_dialog Class Reference

Freeciv-3.2

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

`#include <dialogs.h>`

Inheritance diagram for choice_dialog:

## Public Slots

void | execute_action (const int action)

## Public Member Functions

| choice_dialog (const QString title, const QString text, QWidget *parent=NULL, void(*run_on_close_in)(int)=NULL)
| ~choice_dialog ()
void | set_layout ()
void | add_item (QString title, pfcn_void func, QVariant data1, QVariant data2, QString tool_tip, const int button_id)
void | show_me ()
void | stack_button (Choice_dialog_button *button)
void | unstack_all_buttons ()
QVBoxLayout * | get_layout ()
Choice_dialog_button * | get_identified_button (const int id)
void | update_dialog (const struct act_prob *act_probs)

## Data Fields

int | unit_id
int | target_id [ATK_COUNT]
int | sub_target_id [ASTK_COUNT]
struct unit * | targeted_unit

## Private Slots

void | prev_unit ()
void | next_unit ()

## Private Member Functions

void | switch_target ()

## Private Attributes

QPushButton * | target_unit_button
QVBoxLayout * | layout
QHBoxLayout * | unit_skip
QList< Choice_dialog_button * > | buttons_list
QList< Choice_dialog_button * > | last_buttons_stack
QList< Choice_dialog_button * > | action_button_map
void(* | run_on_close )(int)

## Detailed Description

Definition at line 259 of file dialogs.h.

## Constructor & Destructor Documentation

## ◆ choice_dialog()

choice_dialog::choice_dialog | ( | const QString | title,
|  | const QString | text,
|  | QWidget * | parent = `NULL`,
|  | void(*)(int) | run_on_close_in = `NULL`
| ) |  |

Constructor for choice_dialog

Definition at line 1393 of file dialogs.cpp.

## ◆ ~choice_dialog()

choice_dialog::~choice_dialog | ( |  | ) |

Destructor for choice dialog

Definition at line 1431 of file dialogs.cpp.

## Member Function Documentation

## ◆ add_item()

void choice_dialog::add_item | ( | QString | title,
|  | pfcn_void | func,
|  | QVariant | data1,
|  | QVariant | data2,
|  | QString | tool_tip = `""`,
|  | const int | button_id = `-1`
| ) |  |

Adds new action for choice dialog

Definition at line 1488 of file dialogs.cpp.

## ◆ execute_action

void choice_dialog::execute_action | ( | const int | action | ) |

slot

Run chosen action and close dialog

Definition at line 1694 of file dialogs.cpp.

Referenced by add_item().

## ◆ get_identified_button()

Choice_dialog_button * choice_dialog::get_identified_button | ( | const int | id | ) |

Get the button with the given identity.

Definition at line 1540 of file dialogs.cpp.

## ◆ get_layout()

QVBoxLayout * choice_dialog::get_layout | ( |  | ) |

Returns layout in choice dialog

Definition at line 1532 of file dialogs.cpp.

## ◆ next_unit

void choice_dialog::next_unit | ( |  | ) |

privateslot

Focus next target

Definition at line 1588 of file dialogs.cpp.

Referenced by set_layout().

## ◆ prev_unit

void choice_dialog::prev_unit | ( |  | ) |

privateslot

Focus previous target

Definition at line 1628 of file dialogs.cpp.

Referenced by set_layout().

## ◆ set_layout()

void choice_dialog::set_layout | ( |  | ) |

Sets layout for choice dialog

Definition at line 1446 of file dialogs.cpp.

## ◆ show_me()

void choice_dialog::show_me | ( |  | ) |

Shows choice dialog

Definition at line 1518 of file dialogs.cpp.

## ◆ stack_button()

void choice_dialog::stack_button | ( | Choice_dialog_button * | button | ) |

Put the button in the stack and temporarily remove it. When unstack_all_buttons() is called all buttons in the stack will be added to the end of the dialog.

Can be used to place a button below existing buttons or below buttons added while it was in the stack.

Definition at line 1711 of file dialogs.cpp.

## ◆ switch_target()

void choice_dialog::switch_target | ( |  | ) |

private

Switches target unit

Definition at line 1675 of file dialogs.cpp.

Referenced by next_unit(), and prev_unit().

## ◆ unstack_all_buttons()

void choice_dialog::unstack_all_buttons | ( |  | ) |

Put all the buttons in the stack back to the dialog. They will appear after any other buttons. See stack_button()

Definition at line 1728 of file dialogs.cpp.

## ◆ update_dialog()

void choice_dialog::update_dialog | ( | const struct act_prob * | act_probs | ) |

Update dialog for new target (targeted_unit)

Definition at line 1657 of file dialogs.cpp.

## Field Documentation

## ◆ action_button_map

QList<Choice_dialog_button *> choice_dialog::action_button_map

private

Definition at line 267 of file dialogs.h.

Referenced by add_item(), choice_dialog(), get_identified_button(), and ~choice_dialog().

## ◆ buttons_list

QList<Choice_dialog_button *> choice_dialog::buttons_list

private

Definition at line 265 of file dialogs.h.

Referenced by add_item(), execute_action(), stack_button(), unstack_all_buttons(), and ~choice_dialog().

## ◆ last_buttons_stack

QList<Choice_dialog_button *> choice_dialog::last_buttons_stack

private

Definition at line 266 of file dialogs.h.

Referenced by stack_button(), and unstack_all_buttons().

## ◆ layout

QVBoxLayout* choice_dialog::layout

private

Definition at line 263 of file dialogs.h.

Referenced by add_item(), choice_dialog(), get_layout(), set_layout(), stack_button(), switch_target(), unstack_all_buttons(), and update_dialog().

## ◆ run_on_close

void(* choice_dialog::run_on_close) (int)

private

Definition at line 268 of file dialogs.h.

Referenced by choice_dialog(), and ~choice_dialog().

## ◆ sub_target_id

int choice_dialog::sub_target_id[ASTK_COUNT]

Definition at line 285 of file dialogs.h.

Referenced by choice_dialog(), and update_dialog().

## ◆ target_id

int choice_dialog::target_id[ATK_COUNT]

Definition at line 284 of file dialogs.h.

Referenced by choice_dialog(), and set_layout().

## ◆ target_unit_button

QPushButton* choice_dialog::target_unit_button

private

Definition at line 262 of file dialogs.h.

Referenced by next_unit(), prev_unit(), and set_layout().

## ◆ targeted_unit

struct unit* choice_dialog::targeted_unit

Definition at line 286 of file dialogs.h.

Referenced by choice_dialog(), next_unit(), prev_unit(), set_layout(), switch_target(), and update_dialog().

## ◆ unit_id

int choice_dialog::unit_id

Definition at line 283 of file dialogs.h.

Referenced by choice_dialog(), set_layout(), switch_target(), update_dialog(), and ~choice_dialog().

## ◆ unit_skip

QHBoxLayout* choice_dialog::unit_skip

private

Definition at line 264 of file dialogs.h.

Referenced by set_layout(), switch_target(), and update_dialog().