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 GtkTreePath *path = NULL;
258 if (GDK_BUTTON_PRESS != ev->type || 3 != ev->button) {
262 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(
widget), ev->x, ev->y,
263 &path, NULL, NULL, NULL)) {
267 model = gtk_tree_view_get_model(GTK_TREE_VIEW(
widget));
268 if (gtk_tree_model_get_iter(model, &iter, path)) {
272 gtk_tree_path_free(path);
281 int response, gpointer data)
284 GtkTreeSelection *selection;
298 selection = gtk_tree_view_get_selection(pdialog->
tree_view);
299 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
321 GtkWidget *
view, *sw, *cmd, *notebook;
324 GtkTreeSelection *selection;
325 GtkCellRenderer *renderer;
326 GtkTreeViewColumn *col;
338 vbox = GTK_CONTAINER(pdialog->
shell->
vbox);
340 sw = gtk_scrolled_window_new(NULL, NULL);
341 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
342 GTK_SHADOW_ETCHED_IN);
343 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
344 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
345 gtk_container_add(vbox, sw);
348 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
351 g_object_unref(store);
352 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(
view));
353 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
354 g_signal_connect(
view,
"row_activated",
356 g_signal_connect(
view,
"button-press-event",
360 renderer = gtk_cell_renderer_pixbuf_new();
361 col = gtk_tree_view_column_new_with_attributes(NULL, renderer,
363 gtk_tree_view_append_column(GTK_TREE_VIEW(
view), col);
364 gtk_tree_view_column_set_visible(col, !
GUI_GTK_OPTION(small_display_layout));
366 renderer = gtk_cell_renderer_text_new();
367 col = gtk_tree_view_column_new_with_attributes(NULL, renderer,
372 gtk_tree_view_append_column(GTK_TREE_VIEW(
view), col);
373 gtk_container_add(GTK_CONTAINER(sw),
view);
375 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(
view));
376 g_signal_connect(selection,
"changed",
385 gtk_widget_set_sensitive(cmd,
FALSE);
389 gtk_widget_set_sensitive(cmd,
FALSE);
410 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)
GtkWidget * gui_dialog_add_stockbutton(struct gui_dialog *dlg, const char *stock, 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)
#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)