| t@@ -1794,6 +1794,21 @@ void SetJetButtonTitle(GtkAccelGroup *accel_group) {
_("_Jet!"),button,"clicked",accel_group);
}
+static void SetIcon(GtkWidget *window, gchar **xpmdata)
+{
+#ifndef CYGWIN
+ GdkBitmap *mask;
+ GdkPixmap *icon;
+ GtkStyle *style;
+
+ style = gtk_widget_get_style(window);
+ icon = gdk_pixmap_create_from_xpm_d(window->window, &mask,
+ &style->bg[GTK_STATE_NORMAL],
+ xpmdata);
+ gdk_window_set_icon(window->window, NULL, icon, mask);
+#endif
+}
+
#ifdef CYGWIN
char GtkLoop(HINSTANCE hInstance,HINSTANCE hPrevInstance) {
#else
t@@ -1804,9 +1819,6 @@ char GtkLoop(int *argc,char **argv[],gboolean ReturnOnFail) {
GtkAccelGroup *accel_group;
GtkItemFactory *item_factory;
GtkAdjustment *adj;
- GdkBitmap *mask;
- GdkPixmap *icon;
- GtkStyle *style;
gint nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
#ifdef CYGWIN
t@@ -1902,12 +1914,8 @@ char GtkLoop(int *argc,char **argv[],gboolean ReturnOnFail) {
gtk_widget_show(window);
gtk_widget_realize(window);
- style = gtk_widget_get_style(window);
- icon = gdk_pixmap_create_from_xpm_d(window->window, &mask,
- &style->bg[GTK_STATE_NORMAL],
- dopewars_pill_xpm);
- gdk_window_set_icon(window->window, NULL, icon, mask);
+ SetIcon(window, dopewars_pill_xpm);
gtk_main();
t@@ -1981,7 +1989,8 @@ _("\nFor information on the command line options, type dopewars -h at your\n"
"options.\n"));
gtk_box_pack_start(GTK_BOX(vbox),label,FALSE,FALSE,0);
- label=gtk_label_new("http://dopewars.sourceforge.net/");
+ label=gtk_url_new("http://dopewars.sourceforge.net/",
+ "http://dopewars.sourceforge.net/");
gtk_box_pack_start(GTK_BOX(vbox),label,FALSE,FALSE,0);
hsep=gtk_hseparator_new(); |
| t@@ -4849,4 +4849,52 @@ gint GtkMessageBox(GtkWidget *parent,const gchar *Text,
return retval;
}
+GtkWidget *gtk_url_new(const gchar *text, const gchar *target)
+{
+ GtkWidget *label, *eventbox;
+ GtkUrl *url;
+ int i, len;
+ gchar *pattern;
+ GtkStyle *style;
+ GdkColor color;
+ GdkColormap *colormap;
+ GdkCursor *cursor;
+
+ color.red = 0;
+ color.green = 0;
+ color.blue = 0xDDDD;
+
+ url = g_new0(GtkUrl, 1);
+ url->target = g_strdup(target);
+
+ label = gtk_label_new(text);
+
+ style = gtk_style_new();
+ colormap = gtk_widget_get_colormap(label);
+ gdk_colormap_alloc_color(colormap, &color, FALSE, TRUE);
+ style->fg[GTK_STATE_NORMAL] = color;
+ gtk_widget_set_style(label, style);
+
+ len = strlen(text);
+ pattern = g_new(gchar, len+1);
+ for (i = 0; i < len; i++) pattern[i] = '_';
+ pattern[len] = '\0';
+ gtk_label_set_pattern(GTK_LABEL(label), pattern);
+ g_free(pattern);
+
+ url->label = GTK_LABEL(label);
+
+/*gtk_widget_realize(label);
+
+ cursor = gdk_cursor_new(GDK_HAND2);
+ gdk_window_set_cursor(label->window, cursor);
+ gdk_cursor_destroy(cursor);*/
+
+ eventbox = gtk_event_box_new();
+
+ gtk_container_add(GTK_CONTAINER(eventbox), label);
+
+ return eventbox;
+}
+
#endif /* CYGWIN */ |
| t@@ -510,7 +510,6 @@ struct _GtkTableRowCol {
#define GTK_RADIO_BUTTON(obj) ((GtkRadioButton *)(obj))
#define GTK_CHECK_BUTTON(obj) ((GtkCheckButton *)(obj))
#define GTK_LABEL(obj) ((GtkLabel *)(obj))
-#define GTK_URL(obj) ((GtkUrl *)(obj))
#define GTK_TABLE(obj) ((GtkTable *)(obj))
#define GTK_MENU_SHELL(obj) ((GtkMenuShell *)(obj))
#define GTK_MENU_BAR(obj) ((GtkMenuBar *)(obj))
t@@ -552,7 +551,6 @@ void gtk_container_add(GtkContainer *container,GtkWidget *widget);
void gtk_container_set_border_width(GtkContainer *container,guint border_width);
GtkWidget *gtk_button_new_with_label(const gchar *label);
GtkWidget *gtk_label_new(const gchar *text);
-GtkWidget *gtk_url_new(const gchar *text, const gchar *target);
GtkWidget *gtk_hbox_new(gboolean homogeneous,gint spacing);
GtkWidget *gtk_vbox_new(gboolean homogeneous,gint spacing);
GtkWidget *gtk_check_button_new_with_label(const gchar *label);
t@@ -754,9 +752,18 @@ guint gtk_main_level(void);
/* Other flags */
#define MB_IMMRETURN 16
+typedef struct _GtkUrl GtkUrl;
+
+struct _GtkUrl {
+ GtkLabel *label;
+ gchar *target;
+};
+
#endif /* CYGWIN */
/* Global functions */
+#define GTK_URL(obj) ((GtkUrl *)(obj))
+
gint GtkMessageBox(GtkWidget *parent,const gchar *Text,
const gchar *Title,gint Options);
GtkWidget *gtk_scrolled_clist_new_with_titles(gint columns,gchar *titles[],
t@@ -766,4 +773,6 @@ guint SetAccelerator(GtkWidget *labelparent,gchar *Text,
GtkAccelGroup *accel_group);
GtkWidget *gtk_scrolled_text_new(GtkAdjustment *hadj,GtkAdjustment *vadj,
GtkWidget **pack_widg);
+GtkWidget *gtk_url_new(const gchar *text, const gchar *target);
+
#endif /* __GTKPORT_H__ */ |