92 *weight = (visited ? PANGO_WEIGHT_NORMAL : PANGO_WEIGHT_BOLD);
95 *style = (visited ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL);
103 GtkTreeIter *iter,
bool visited)
105 gint row, weight, style;
109 gtk_list_store_set(GTK_LIST_STORE(model), iter,
121 GtkTreeSelection *selection;
127 int selected, i, num;
128 bool need_alert =
FALSE;
133 selection = gtk_tree_view_get_selection(pdialog->
tree_view);
134 if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
135 gtk_tree_model_get(model, &iter,
MESWIN_COL_ID, &selected, -1);
140 model = gtk_tree_view_get_model(pdialog->
tree_view);
141 store = GTK_LIST_STORE(model);
144 gtk_list_store_clear(store);
145 for (i = 0; i < num; i++) {
148 int x0, y0, x1, y1, w, h;
154 gtk_list_store_prepend(store, &iter);
156 gtk_list_store_append(store, &iter);
163 pb = gdk_pixbuf_new(GDK_COLORSPACE_RGB,
TRUE, 8, w, h);
165 gdk_pixbuf_copy_area(pixbuf, x0, y0, w, h,
167 g_object_unref(G_OBJECT(pixbuf));
170 gtk_list_store_set(store, &iter,
180 gtk_tree_selection_select_iter(selection, &iter);
205 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
215 NULL != pmsg && pmsg->
city_ok);
223 GtkTreeViewColumn *col,
226 GtkTreeModel *model = gtk_tree_view_get_model(
view);
230 if (!gtk_tree_model_get_iter(model, &iter, path)) {
251 GtkWidget *
widget = gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(gesture));
252 GtkTreePath *path = NULL;
259 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(
widget), x, y,
260 &path, NULL, NULL, NULL)) {
264 model = gtk_tree_view_get_model(GTK_TREE_VIEW(
widget));
265 if (gtk_tree_model_get_iter(model, &iter, path)) {
270 gtk_tree_path_free(path);
279 int response, gpointer data)
282 GtkTreeSelection *selection;
296 selection = gtk_tree_view_get_selection(pdialog->
tree_view);
297 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
319 GtkWidget *
view, *sw, *cmd, *notebook;
321 GtkTreeSelection *selection;
322 GtkCellRenderer *renderer;
323 GtkTreeViewColumn *col;
325 GtkEventController *controller;
338 sw = gtk_scrolled_window_new();
339 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
TRUE);
340 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
341 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
345 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
348 g_object_unref(store);
349 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(
view));
350 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
351 g_signal_connect(
view,
"row_activated",
354 gesture = gtk_gesture_click_new();
355 gtk_gesture_single_set_button(GTK_GESTURE_SINGLE(gesture), 3);
356 controller = GTK_EVENT_CONTROLLER(gesture);
357 g_signal_connect(controller,
"pressed",
359 gtk_widget_add_controller(
view, controller);
363 renderer = gtk_cell_renderer_pixbuf_new();
364 col = gtk_tree_view_column_new_with_attributes(NULL, renderer,
366 gtk_tree_view_append_column(GTK_TREE_VIEW(
view), col);
367 gtk_tree_view_column_set_visible(col, !
GUI_GTK_OPTION(small_display_layout));
369 renderer = gtk_cell_renderer_text_new();
370 col = gtk_tree_view_column_new_with_attributes(NULL, renderer,
375 gtk_tree_view_append_column(GTK_TREE_VIEW(
view), col);
376 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw),
view);
378 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(
view));
379 g_signal_connect(selection,
"changed",
389 gtk_widget_set_sensitive(cmd,
FALSE);
393 gtk_widget_set_sensitive(cmd,
FALSE);
414 memset(pdialog, 0,
sizeof(*pdialog));
GtkWidget * bottom_notebook
GtkWidget * right_notebook
#define GUI_GTK_OPTION(optname)
void gui_dialog_destroy(struct gui_dialog *dlg)
void gui_dialog_present(struct gui_dialog *dlg)
void gui_dialog_raise(struct gui_dialog *dlg)
void gui_dialog_new(struct gui_dialog **pdlg, GtkNotebook *notebook, gpointer user_data, bool check_top)
void gui_dialog_response_set_callback(struct gui_dialog *dlg, GUI_DIALOG_RESPONSE_FUN fun)
GtkWidget * gui_dialog_add_button(struct gui_dialog *dlg, const char *text, int response)
void gui_dialog_show_all(struct gui_dialog *dlg)
void gui_dialog_set_title(struct gui_dialog *dlg, const char *title)
void gui_dialog_set_default_size(struct gui_dialog *dlg, int width, int height)
void gui_dialog_alert(struct gui_dialog *dlg)
void gui_dialog_set_response_sensitive(struct gui_dialog *dlg, int response, bool setting)
static void meswin_dialog_init(struct meswin_dialog *pdialog)
static gboolean meswin_dialog_button_press_callback(GtkWidget *widget, GdkEventButton *ev, gpointer data)
void meswin_dialog_popdown(void)
static void meswin_dialog_visited_get_attr(bool visited, gint *weight, gint *style)
static void meswin_dialog_row_activated_callback(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data)
static void meswin_dialog_set_visited(GtkTreeModel *model, GtkTreeIter *iter, bool visited)
static struct meswin_dialog meswin
static GtkListStore * meswin_dialog_store_new(void)
static void meswin_dialog_response_callback(struct gui_dialog *pgui_dialog, int response, gpointer data)
void meswin_dialog_popup(bool raise)
static void meswin_dialog_refresh(struct meswin_dialog *pdialog)
static void meswin_dialog_free(struct meswin_dialog *pdialog)
static void meswin_dialog_selection_callback(GtkTreeSelection *selection, gpointer data)
void real_meswin_dialog_update(void *unused)
bool meswin_dialog_is_open(void)
GdkPixbuf * sprite_get_pixbuf(struct sprite *sprite)
void sprite_get_bounding_box(struct sprite *sprite, int *start_x, int *start_y, int *end_x, int *end_y)
void gui_dialog_add_content_widget(struct gui_dialog *dlg, GtkWidget *wdg)
#define fc_assert_ret(condition)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
void meswin_popup_city(int message_index)
void meswin_goto(int message_index)
int meswin_get_num_messages(void)
const struct message * meswin_get_message(int message_index)
void meswin_double_click(int message_index)
void meswin_set_visited_state(int message_index, bool state)
struct gui_dialog * shell
struct sprite * get_event_sprite(const struct tileset *t, enum event_type event)