Freeciv-3.1
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions
gui_stuff.h File Reference
#include <gtk/gtk.h>
#include "shared.h"

Go to the source code of this file.

Data Structures

struct  ITree
 
struct  gui_dialog
 

Macros

#define TREE_ITER_PTR(x)   (&(x).it)
 
#define menu_item_insert_unref(menu, index, item)
 
#define menu_item_append_unref(menu, item)
 
#define submenu_insert_unref(menu, index, name, submenu)
 
#define submenu_append_unref(menu, name, submenu)
 

Typedefs

typedef void(* GUI_DIALOG_RESPONSE_FUN) (struct gui_dialog *, int, gpointer)
 

Enumerations

enum  gui_dialog_type { GUI_DIALOG_WINDOW , GUI_DIALOG_TAB }
 

Functions

GtkWidget * icon_label_button_new (const gchar *icon_name, const gchar *label_text)
 
void gtk_stockbutton_set_label (GtkWidget *button, const gchar *label_text)
 
void gtk_expose_now (GtkWidget *w)
 
void intl_slist (int n, const char **s, bool *done)
 
void itree_begin (GtkTreeModel *model, ITree *it)
 
gboolean itree_end (ITree *it)
 
void itree_next (ITree *it)
 
void itree_get (ITree *it,...)
 
void itree_set (ITree *it,...)
 
void tstore_append (GtkTreeStore *store, ITree *it, ITree *parent)
 
gboolean itree_is_selected (GtkTreeSelection *selection, ITree *it)
 
void itree_select (GtkTreeSelection *selection, ITree *it)
 
void itree_unselect (GtkTreeSelection *selection, ITree *it)
 
gint gtk_tree_selection_get_row (GtkTreeSelection *selection)
 
void gtk_tree_view_focus (GtkTreeView *view)
 
void setup_dialog (GtkWidget *shell, GtkWidget *parent)
 
GtkTreeViewColumn * add_treeview_column (GtkWidget *view, const char *title, GType gtype, int model_index)
 
GtkWidget * aux_menu_new (void)
 
void dlg_tab_provider_prepare (void)
 
void gui_dialog_new (struct gui_dialog **pdlg, GtkNotebook *notebook, gpointer user_data, bool check_top)
 
GtkWidget * gui_dialog_add_button (struct gui_dialog *dlg, const char *icon_name, const char *text, int response)
 
GtkWidget * gui_dialog_add_action_widget (struct gui_dialog *dlg, GtkWidget *widget)
 
void gui_dialog_add_content_widget (struct gui_dialog *dlg, GtkWidget *wdg)
 
void gui_dialog_set_default_size (struct gui_dialog *dlg, int width, int height)
 
void gui_dialog_set_title (struct gui_dialog *dlg, const char *title)
 
void gui_dialog_set_response_sensitive (struct gui_dialog *dlg, int response, bool setting)
 
void gui_dialog_show_all (struct gui_dialog *dlg)
 
void gui_dialog_present (struct gui_dialog *dlg)
 
void gui_dialog_raise (struct gui_dialog *dlg)
 
void gui_dialog_alert (struct gui_dialog *dlg)
 
void gui_dialog_destroy (struct gui_dialog *dlg)
 
void gui_dialog_destroy_all (void)
 
GtkWidget * gui_dialog_get_toplevel (struct gui_dialog *dlg)
 
void gui_dialog_response_set_callback (struct gui_dialog *dlg, GUI_DIALOG_RESPONSE_FUN fun)
 
void gui_dialog_set_return_dialog (struct gui_dialog *dlg, struct gui_dialog *return_dialog)
 
void gui_update_font_full (const char *font_name, const char *font_value, PangoFontDescription **font_desc)
 
void disable_gobject_callback (GObject *obj, GCallback cb)
 
void enable_gobject_callback (GObject *obj, GCallback cb)
 
gint blocking_dialog (GtkWidget *dlg)
 
void widget_destroyed (GtkWidget *wdg, void *data)
 
GtkWidget * widget_get_child (GtkWidget *wdg)
 

Macro Definition Documentation

◆ menu_item_append_unref

#define menu_item_append_unref (   menu,
  item 
)
Value:
{ \
GMenuItem *_item_var = item; \
g_menu_append_item(menu, _item_var); \
g_object_unref(_item_var); \
}
Definition climisc.h:82

Definition at line 149 of file gui_stuff.h.

◆ menu_item_insert_unref

#define menu_item_insert_unref (   menu,
  index,
  item 
)
Value:
{ \
GMenuItem *_item_var = item; \
g_menu_insert_item(menu, index, _item_var); \
g_object_unref(_item_var); \
}

Definition at line 142 of file gui_stuff.h.

◆ submenu_append_unref

#define submenu_append_unref (   menu,
  name,
  submenu 
)
Value:
{ \
GMenuModel *_submenu_var = submenu; \
g_menu_append_submenu(menu, name, _submenu_var); \
g_object_unref(_submenu_var); \
}
const char * name
Definition inputfile.c:127

Definition at line 165 of file gui_stuff.h.

◆ submenu_insert_unref

#define submenu_insert_unref (   menu,
  index,
  name,
  submenu 
)
Value:
{ \
GMenuModel *_submenu_var = submenu; \
g_menu_insert_submenu(menu, index, name, \
_submenu_var); \
g_object_unref(_submenu_var); \
}

Definition at line 156 of file gui_stuff.h.

◆ TREE_ITER_PTR

#define TREE_ITER_PTR (   x)    (&(x).it)

Definition at line 37 of file gui_stuff.h.

Typedef Documentation

◆ GUI_DIALOG_RESPONSE_FUN

typedef void(* GUI_DIALOG_RESPONSE_FUN) (struct gui_dialog *, int, gpointer)

Definition at line 66 of file gui_stuff.h.

Enumeration Type Documentation

◆ gui_dialog_type

Enumerator
GUI_DIALOG_WINDOW 
GUI_DIALOG_TAB 

Definition at line 59 of file gui_stuff.h.

Function Documentation

◆ add_treeview_column()

GtkTreeViewColumn * add_treeview_column ( GtkWidget *  view,
const char *  title,
GType  gtype,
int  model_index 
)

Convenience function to add a column to a GtkTreeView. Returns the added column, or NULL if an error occurred.

Definition at line 1120 of file gui_stuff.c.

Referenced by create_network_page().

◆ aux_menu_new()

GtkWidget * aux_menu_new ( void  )

Create an auxiliary menubar (i.e., not the main menubar at the top of the window).

Definition at line 243 of file gui_stuff.c.

Referenced by create_city_report_menu(), create_diplomacy_dialog(), create_players_dialog(), and create_worklist().

◆ blocking_dialog()

gint blocking_dialog ( GtkWidget *  dlg)

◆ disable_gobject_callback()

void disable_gobject_callback ( GObject *  obj,
GCallback  cb 
)

Temporarily disable signal invocation of the given callback for the given GObject. Re-enable the signal with enable_gobject_callback.

Definition at line 1087 of file gui_stuff.c.

Referenced by extviewer_clear_widgets(), extviewer_refresh_widgets(), objprop_refresh_widget(), and refresh_all_buttons().

◆ dlg_tab_provider_prepare()

void dlg_tab_provider_prepare ( void  )

Prepare dialog tab style provider.

Definition at line 1151 of file gui_stuff.c.

Referenced by activate_gui(), and ui_main().

◆ enable_gobject_callback()

void enable_gobject_callback ( GObject *  obj,
GCallback  cb 
)

Re-enable a signal callback blocked by disable_gobject_callback.

Definition at line 1103 of file gui_stuff.c.

Referenced by extviewer_clear_widgets(), extviewer_refresh_widgets(), objprop_refresh_widget(), and refresh_all_buttons().

◆ gtk_expose_now()

void gtk_expose_now ( GtkWidget *  w)

Draw widget now

Definition at line 50 of file gui_stuff.c.

◆ gtk_stockbutton_set_label()

void gtk_stockbutton_set_label ( GtkWidget *  button,
const gchar *  label_text 
)

Changes the label (with mnemonic) on an existing stockbutton. See gtk_stockbutton_new.

Definition at line 90 of file gui_stuff.c.

Referenced by update_start_page_buttons().

◆ gtk_tree_selection_get_row()

gint gtk_tree_selection_get_row ( GtkTreeSelection *  selection)

Return the selected row in a GtkTreeSelection. If no row is selected return -1.

Definition at line 209 of file gui_stuff.c.

Referenced by cma_add_preset_callback(), cma_del_preset_callback(), cma_preset_key_pressed(), and cma_preset_key_pressed_callback().

◆ gtk_tree_view_focus()

void gtk_tree_view_focus ( GtkTreeView *  view)

◆ gui_dialog_add_action_widget()

GtkWidget * gui_dialog_add_action_widget ( struct gui_dialog dlg,
GtkWidget *  widget 
)

Adds a widget to a dialog.

Definition at line 680 of file gui_stuff.c.

Referenced by create_city_report_dialog(), create_players_dialog(), and gui_dialog_pack_button().

◆ gui_dialog_add_button()

GtkWidget * gui_dialog_add_button ( struct gui_dialog dlg,
const char *  icon_name,
const char *  text,
int  response 
)

Adds a button to a dialog.

Definition at line 702 of file gui_stuff.c.

◆ gui_dialog_add_content_widget()

void gui_dialog_add_content_widget ( struct gui_dialog dlg,
GtkWidget *  wdg 
)

◆ gui_dialog_alert()

void gui_dialog_alert ( struct gui_dialog dlg)

◆ gui_dialog_destroy()

void gui_dialog_destroy ( struct gui_dialog dlg)

◆ gui_dialog_destroy_all()

void gui_dialog_destroy_all ( void  )

Destroy all dialogs.

Definition at line 971 of file gui_stuff.c.

Referenced by popdown_all_game_dialogs().

◆ gui_dialog_get_toplevel()

GtkWidget * gui_dialog_get_toplevel ( struct gui_dialog dlg)

Get the dialog's toplevel window.

Definition at line 786 of file gui_stuff.c.

Referenced by economy_report_command_callback(), and units_report_command_callback().

◆ gui_dialog_new()

void gui_dialog_new ( struct gui_dialog **  pdlg,
GtkNotebook *  notebook,
gpointer  user_data,
bool  check_top 
)

Creates a new dialog. It will be a tab or a window depending on the current user setting of 'enable_tabs' gtk-gui option. Sets pdlg to point to the dialog once it is create, Zeroes pdlg on dialog destruction. user_data will be passed through response function check_top indicates if the layout decision should depend on the parent.

Definition at line 504 of file gui_stuff.c.

Referenced by create_city_report_dialog(), create_diplomacy_dialog(), create_messageopt_dialog(), create_players_dialog(), create_spaceship_dialog(), diplomacy_main_create(), economy_report_init(), endgame_report_init(), luaconsole_dialog_create(), meswin_dialog_init(), popup_find_dialog(), popup_notify_dialog(), science_report_init(), and units_report_init().

◆ gui_dialog_present()

void gui_dialog_present ( struct gui_dialog dlg)

◆ gui_dialog_raise()

void gui_dialog_raise ( struct gui_dialog dlg)

◆ gui_dialog_response_set_callback()

void gui_dialog_response_set_callback ( struct gui_dialog dlg,
GUI_DIALOG_RESPONSE_FUN  fun 
)

◆ gui_dialog_set_default_size()

void gui_dialog_set_default_size ( struct gui_dialog dlg,
int  width,
int  height 
)

◆ gui_dialog_set_response_sensitive()

void gui_dialog_set_response_sensitive ( struct gui_dialog dlg,
int  response,
bool  setting 
)

Change the sensitivity of a dialog button.

Definition at line 759 of file gui_stuff.c.

Referenced by economy_report_selection_callback(), meswin_dialog_selection_callback(), refresh_spaceship_dialog(), and units_report_selection_callback().

◆ gui_dialog_set_return_dialog()

void gui_dialog_set_return_dialog ( struct gui_dialog dlg,
struct gui_dialog return_dialog 
)

When the dlg dialog is destroyed the return_dialog will be raised

Definition at line 994 of file gui_stuff.c.

Referenced by gui_dialog_delete_tab_handler(), and popup_diplomacy_dialog().

◆ gui_dialog_set_title()

void gui_dialog_set_title ( struct gui_dialog dlg,
const char *  title 
)

◆ gui_dialog_show_all()

void gui_dialog_show_all ( struct gui_dialog dlg)

◆ gui_update_font_full()

void gui_update_font_full ( const char *  font_name,
const char *  font_value,
PangoFontDescription **  font_desc 
)

Update a font option which is not attached to a widget.

Definition at line 1070 of file gui_stuff.c.

Referenced by apply_city_names_font(), apply_city_productions_font(), and apply_reqtree_text_font().

◆ icon_label_button_new()

GtkWidget * icon_label_button_new ( const gchar *  icon_name,
const gchar *  label_text 
)

Create new icon button with label

Create new icon button with label.

Current implementation sets either icon or label, preferring label, never both. Caller should not rely on that, though.

Definition at line 76 of file gui_stuff.c.

Referenced by create_and_append_overview_page(), create_cma_dialog(), create_main_page(), create_production_header(), create_production_header(), create_start_page(), create_worklist(), and gui_dialog_add_button().

◆ intl_slist()

void intl_slist ( int  n,
const char **  s,
bool done 
)

Returns gettext-converted list of n strings. The individual strings in the list are as returned by gettext(). In case of no NLS, the strings will be the original strings, so caller should ensure that the originals persist for as long as required. (For no NLS, still allocate the list, for consistency.)

(This is not directly gui/gtk related, but it fits in here because so far it is used for doing i18n for gtk titles...)

Definition at line 105 of file gui_stuff.c.

Referenced by create_and_append_settings_page(), create_city_info_table(), create_city_info_table(), create_happiness_dialog(), populate_view(), and usdlg_tab_select().

◆ itree_begin()

void itree_begin ( GtkTreeModel *  model,
ITree it 
)

◆ itree_end()

gboolean itree_end ( ITree it)

◆ itree_get()

void itree_get ( ITree it,
  ... 
)

Get values from itree

Definition at line 158 of file gui_stuff.c.

Referenced by messageopt_response(), real_city_report_dialog_update(), and science_report_combo_set_active().

◆ itree_is_selected()

gboolean itree_is_selected ( GtkTreeSelection *  selection,
ITree it 
)

◆ itree_next()

void itree_next ( ITree it)

◆ itree_select()

void itree_select ( GtkTreeSelection *  selection,
ITree it 
)

◆ itree_set()

void itree_set ( ITree it,
  ... 
)

Store values to itree

Definition at line 146 of file gui_stuff.c.

◆ itree_unselect()

void itree_unselect ( GtkTreeSelection *  selection,
ITree it 
)

Remove current itree item from selection

Definition at line 200 of file gui_stuff.c.

Referenced by city_invert_selection_callback(), and city_invert_selection_callback().

◆ setup_dialog()

void setup_dialog ( GtkWidget *  shell,
GtkWidget *  parent 
)

◆ tstore_append()

void tstore_append ( GtkTreeStore *  store,
ITree it,
ITree parent 
)

Append one item to the end of tree store

Definition at line 170 of file gui_stuff.c.

◆ widget_destroyed()

void widget_destroyed ( GtkWidget *  wdg,
void *  data 
)

◆ widget_get_child()

GtkWidget * widget_get_child ( GtkWidget *  wdg)

Get child widget for a widget whose own type is not known (without further GTK_IS_...() checks) in the caller side.

Definition at line 1154 of file gui_stuff.c.