Mercurial > dwindows
annotate gtk3/dw.c @ 779:d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
Fixed the ok and cancel buttons on the color chooser.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 20 Mar 2011 23:40:34 +0000 |
parents | 99ce0ea1f271 |
children | fda93b441c4d |
rev | line source |
---|---|
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2 * Dynamic Windows: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3 * A GTK like implementation of the PM GUI |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4 * GTK3 forwarder module for portabilty. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5 * |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6 * (C) 2000-2011 Brian Smith <brian@dbsoft.org> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7 * (C) 2003-2004 Mark Hessling <m.hessling@qut.edu.au> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8 * (C) 2002 Nickolay V. Shmyrev <shmyrev@yandex.ru> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10 #include "config.h" |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11 #include "dw.h" |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
12 #include <string.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
13 #include <stdlib.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
14 #if !defined(GDK_WINDOWING_WIN32) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
15 # include <sys/utsname.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
16 # include <sys/socket.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
17 # include <sys/un.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
18 # include <sys/mman.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
19 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
20 #include <stdarg.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
21 #include <stdio.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
22 #include <unistd.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
23 #include <errno.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
24 #include <sys/time.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
25 #include <dirent.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
26 #include <sys/stat.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
27 #include <signal.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
28 #include <fcntl.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
29 #include <unistd.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
30 #include <gdk/gdkkeysyms.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
31 #ifdef USE_IMLIB |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
32 #include <gdk_imlib.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
33 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
34 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
35 #ifdef USE_GTKMOZEMBED |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
36 # include <gtkmozembed.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
37 # undef GTK_TYPE_MOZ_EMBED |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
38 # define GTK_TYPE_MOZ_EMBED (_dw_moz_embed_get_type()) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
39 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
40 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
41 #ifdef USE_LIBGTKHTML2 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
42 # include <libgtkhtml/gtkhtml.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
43 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
44 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
45 #ifdef USE_WEBKIT |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
46 # if defined(USE_WEBKIT10) || defined(USE_WEBKIT11) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
47 # include <webkit/webkit.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
48 # else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
49 # include <webkit.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
50 # endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
51 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
52 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
53 #include <gdk-pixbuf/gdk-pixbuf.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
54 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
55 #if __STDC_VERSION__ < 199901L |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
56 # if __GNUC__ >= 2 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
57 # define __func__ __FUNCTION__ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
58 # else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
59 # define __func__ "<unknown>" |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
60 # endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
61 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
62 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
63 #include "gtk/messagebox_error.xpm" |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
64 #include "gtk/messagebox_warning.xpm" |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
65 #include "gtk/messagebox_information.xpm" |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
66 #include "gtk/messagebox_question.xpm" |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
67 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
68 #ifdef USE_GTKMOZEMBED |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
69 extern gint mozilla_get_mouse_event_button(gpointer event); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
70 extern gint mozilla_get_mouse_location( gpointer event, glong *x, glong *y); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
71 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
72 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
73 /* These are used for resource management */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
74 #if defined(DW_RESOURCES) && !defined(BUILD_DLL) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
75 extern DWResources _resources; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
76 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
77 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
78 GdkColor _colors[] = |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
79 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
80 { 0, 0x0000, 0x0000, 0x0000 }, /* 0 black */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
81 { 0, 0xbbbb, 0x0000, 0x0000 }, /* 1 red */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
82 { 0, 0x0000, 0xbbbb, 0x0000 }, /* 2 green */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
83 { 0, 0xaaaa, 0xaaaa, 0x0000 }, /* 3 yellow */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
84 { 0, 0x0000, 0x0000, 0xcccc }, /* 4 blue */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
85 { 0, 0xbbbb, 0x0000, 0xbbbb }, /* 5 magenta */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
86 { 0, 0x0000, 0xbbbb, 0xbbbb }, /* 6 cyan */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
87 { 0, 0xbbbb, 0xbbbb, 0xbbbb }, /* 7 white */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
88 { 0, 0x7777, 0x7777, 0x7777 }, /* 8 grey */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
89 { 0, 0xffff, 0x0000, 0x0000 }, /* 9 bright red */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
90 { 0, 0x0000, 0xffff, 0x0000 }, /* 10 bright green */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
91 { 0, 0xeeee, 0xeeee, 0x0000 }, /* 11 bright yellow */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
92 { 0, 0x0000, 0x0000, 0xffff }, /* 12 bright blue */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
93 { 0, 0xffff, 0x0000, 0xffff }, /* 13 bright magenta */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
94 { 0, 0x0000, 0xeeee, 0xeeee }, /* 14 bright cyan */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
95 { 0, 0xffff, 0xffff, 0xffff }, /* 15 bright white */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
96 }; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
97 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
98 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
99 * List those icons that have transparency first |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
100 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
101 #define NUM_EXTS 5 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
102 char *image_exts[NUM_EXTS] = |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
103 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
104 ".xpm", |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
105 ".png", |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
106 ".ico", |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
107 ".jpg", |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
108 ".bmp", |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
109 }; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
110 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
111 #define DW_THREAD_LIMIT 50 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
112 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
113 #ifndef max |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
114 # define max(a,b) (((a) > (b)) ? (a) : (b)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
115 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
116 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
117 #ifndef min |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
118 # define min(a,b) (((a) < (b)) ? (a) : (b)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
119 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
120 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
121 FILE *dbgfp = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
122 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
123 DWTID _dw_thread_list[DW_THREAD_LIMIT]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
124 GdkColor _foreground[DW_THREAD_LIMIT]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
125 GdkColor _background[DW_THREAD_LIMIT]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
126 int _transparent[DW_THREAD_LIMIT]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
127 GtkClipboard *_clipboard_object[DW_THREAD_LIMIT]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
128 gchar *_clipboard_contents[DW_THREAD_LIMIT]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
129 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
130 GtkWidget *last_window = NULL, *popup = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
131 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
132 static int _dw_ignore_click = 0, _dw_ignore_expand = 0, _dw_color_active = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
133 static pthread_t _dw_thread = (pthread_t)-1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
134 static int _dw_mutex_locked[DW_THREAD_LIMIT]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
135 /* Use default border size for the default enlightenment theme */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
136 static int _dw_border_width = 12, _dw_border_height = 28; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
137 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
138 #define DW_MUTEX_LOCK { int index = _find_thread_index(dw_thread_id()); if(pthread_self() != _dw_thread && _dw_mutex_locked[index] == FALSE) { gdk_threads_enter(); _dw_mutex_locked[index] = TRUE; _locked_by_me = TRUE; } } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
139 #define DW_MUTEX_UNLOCK { if(pthread_self() != _dw_thread && _locked_by_me == TRUE) { gdk_threads_leave(); _dw_mutex_locked[_find_thread_index(dw_thread_id())] = FALSE; _locked_by_me = FALSE; } } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
140 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
141 #define DEFAULT_SIZE_WIDTH 12 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
142 #define DEFAULT_SIZE_HEIGHT 6 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
143 #define DEFAULT_TITLEBAR_HEIGHT 22 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
144 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
145 /* Signal forwarder prototypes */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
146 static gint _button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
147 static gint _button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
148 static gint _motion_notify_event(GtkWidget *widget, GdkEventMotion *event, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
149 static gint _delete_event(GtkWidget *widget, GdkEvent *event, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
150 static gint _key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
151 static gint _generic_event(GtkWidget *widget, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
152 static gint _configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
153 static gint _activate_event(GtkWidget *widget, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
154 static gint _container_select_event(GtkWidget *widget, GdkEventButton *event, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
155 static gint _item_select_event(GtkWidget *widget, GtkWidget *child, gpointer data); |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
156 static gint _expose_event(GtkWidget *widget, cairo_t *cr, gpointer data); |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
157 static gint _set_focus_event(GtkWindow *window, GtkWidget *widget, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
158 static gint _tree_context_event(GtkWidget *widget, GdkEventButton *event, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
159 static gint _value_changed_event(GtkAdjustment *adjustment, gpointer user_data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
160 static gint _tree_select_event(GtkTreeSelection *sel, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
161 static gint _tree_expand_event(GtkTreeView *treeview, GtkTreeIter *arg1, GtkTreePath *arg2, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
162 static gint _switch_page_event(GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
163 static gint _column_click_event(GtkWidget *widget, gint column_num, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
164 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
165 /* Embedable Mozilla functions*/ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
166 #ifdef USE_GTKMOZEMBED |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
167 void (*_gtk_moz_embed_go_back)(GtkMozEmbed *) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
168 void (*_gtk_moz_embed_go_forward)(GtkMozEmbed *) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
169 void (*_gtk_moz_embed_load_url)(GtkMozEmbed *, const char *) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
170 void (*_gtk_moz_embed_reload)(GtkMozEmbed *, guint32) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
171 void (*_gtk_moz_embed_stop_load)(GtkMozEmbed *) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
172 void (*_gtk_moz_embed_render_data)(GtkMozEmbed *, const char *, guint32, const char *, const char *) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
173 GtkWidget *(*_gtk_moz_embed_new)(void) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
174 GtkType (*_dw_moz_embed_get_type)(void) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
175 gboolean (*_gtk_moz_embed_can_go_back)(GtkMozEmbed *) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
176 gboolean (*_gtk_moz_embed_can_go_forward)(GtkMozEmbed *) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
177 void (*_gtk_moz_embed_set_comp_path)(const char *) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
178 void (*_gtk_moz_embed_set_profile_path)(const char *, const char *) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
179 void (*_gtk_moz_embed_push_startup)(void) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
180 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
181 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
182 #ifdef USE_LIBGTKHTML2 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
183 GtkHtmlContext *(*_gtk_html_context_get)(void) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
184 HtmlDocument *(*_html_document_new)(void) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
185 GtkWidget *(*_html_view_new)(void) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
186 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
187 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
188 #ifdef USE_WEBKIT |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
189 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
190 * we need to add these equivalents from webkitwebview.h so we can refer to |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
191 * our own pointers to functions (we don't link with the webkit libraries |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
192 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
193 # define DW_WEBKIT_TYPE_WEB_VIEW (_webkit_web_view_get_type()) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
194 # define DW_WEBKIT_WEB_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), DW_WEBKIT_TYPE_WEB_VIEW, WebKitWebView)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
195 WEBKIT_API GType (*_webkit_web_view_get_type)(void) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
196 WEBKIT_API void (*_webkit_web_view_load_html_string)(WebKitWebView *, const gchar *, const gchar *) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
197 WEBKIT_API void (*_webkit_web_view_open)(WebKitWebView *, const gchar *) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
198 WEBKIT_API GtkWidget *(*_webkit_web_view_new)(void) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
199 WEBKIT_API void (*_webkit_web_view_go_back)(WebKitWebView *) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
200 WEBKIT_API void (*_webkit_web_view_go_forward)(WebKitWebView *) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
201 WEBKIT_API void (*_webkit_web_view_reload)(WebKitWebView *) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
202 WEBKIT_API void (*_webkit_web_view_stop_loading)(WebKitWebView *) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
203 # ifdef WEBKIT_CHECK_VERSION |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
204 # if WEBKIT_CHECK_VERSION(1,1,5) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
205 WEBKIT_API void (*_webkit_web_frame_print)(WebKitWebFrame *) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
206 WEBKIT_API WebKitWebFrame *(*_webkit_web_view_get_focused_frame)(WebKitWebView *) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
207 # endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
208 # endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
209 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
210 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
211 typedef struct |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
212 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
213 GdkPixbuf *pixbuf; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
214 int used; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
215 unsigned long width, height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
216 } DWPrivatePixmap; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
217 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
218 static DWPrivatePixmap *_PixmapArray = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
219 static int _PixmapCount = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
220 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
221 typedef struct |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
222 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
223 void *func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
224 char name[30]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
225 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
226 } SignalList; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
227 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
228 typedef struct |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
229 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
230 HWND window; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
231 void *func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
232 gpointer data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
233 gint cid; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
234 void *intfunc; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
235 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
236 } SignalHandler; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
237 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
238 #define SIGNALMAX 19 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
239 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
240 /* A list of signal forwarders, to account for paramater differences. */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
241 static SignalList SignalTranslate[SIGNALMAX] = { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
242 { _configure_event, DW_SIGNAL_CONFIGURE }, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
243 { _key_press_event, DW_SIGNAL_KEY_PRESS }, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
244 { _button_press_event, DW_SIGNAL_BUTTON_PRESS }, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
245 { _button_release_event, DW_SIGNAL_BUTTON_RELEASE }, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
246 { _motion_notify_event, DW_SIGNAL_MOTION_NOTIFY }, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
247 { _delete_event, DW_SIGNAL_DELETE }, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
248 { _expose_event, DW_SIGNAL_EXPOSE }, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
249 { _activate_event, "activate" }, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
250 { _generic_event, DW_SIGNAL_CLICKED }, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
251 { _container_select_event, DW_SIGNAL_ITEM_ENTER }, |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
252 { _tree_context_event, DW_SIGNAL_ITEM_CONTEXT }, |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
253 { _item_select_event, DW_SIGNAL_LIST_SELECT }, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
254 { _tree_select_event, DW_SIGNAL_ITEM_SELECT }, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
255 { _set_focus_event, DW_SIGNAL_SET_FOCUS }, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
256 { _value_changed_event, DW_SIGNAL_VALUE_CHANGED }, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
257 { _switch_page_event, DW_SIGNAL_SWITCH_PAGE }, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
258 { _column_click_event, DW_SIGNAL_COLUMN_CLICK }, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
259 { _tree_expand_event, DW_SIGNAL_TREE_EXPAND } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
260 }; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
261 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
262 /* Alignment flags */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
263 #define DW_CENTER 0.5f |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
264 #define DW_LEFT 0.0f |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
265 #define DW_RIGHT 1.0f |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
266 #define DW_TOP 0.0f |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
267 #define DW_BOTTOM 1.0f |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
268 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
269 /* MDI Support Code */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
270 #define GTK_MDI(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gtk_mdi_get_type (), GtkMdi) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
271 #define GTK_MDI_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gtk_mdi_get_type (), GtkMdiClass) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
272 #define GTK_IS_MDI(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gtk_mdi_get_type ()) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
273 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
274 typedef struct _GtkMdi GtkMdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
275 typedef struct _GtkMdiClass GtkMdiClass; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
276 typedef struct _GtkMdiDragInfo GtkMdiDragInfo; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
277 typedef enum _GtkMdiChildState GtkMdiChildState; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
278 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
279 enum _GtkMdiChildState |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
280 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
281 CHILD_NORMAL, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
282 CHILD_MAXIMIZED, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
283 CHILD_ICONIFIED |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
284 }; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
285 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
286 struct _GtkMdi |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
287 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
288 GtkContainer container; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
289 GList *children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
290 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
291 GdkPoint drag_start; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
292 gint drag_button; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
293 }; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
294 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
295 struct _GtkMdiClass |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
296 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
297 GtkContainerClass parent_class; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
298 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
299 void (*mdi) (GtkMdi * mdi); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
300 }; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
301 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
302 #include "gtk/maximize.xpm" |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
303 #include "gtk/minimize.xpm" |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
304 #include "gtk/kill.xpm" |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
305 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
306 #define GTK_MDI_BACKGROUND "Grey70" |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
307 #define GTK_MDI_LABEL_BACKGROUND "RoyalBlue4" |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
308 #define GTK_MDI_LABEL_FOREGROUND "white" |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
309 #define GTK_MDI_DEFAULT_WIDTH 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
310 #define GTK_MDI_DEFAULT_HEIGHT 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
311 #define GTK_MDI_MIN_HEIGHT 22 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
312 #define GTK_MDI_MIN_WIDTH 55 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
313 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
314 typedef struct _GtkMdiChild GtkMdiChild; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
315 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
316 struct _GtkMdiChild |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
317 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
318 GtkWidget *widget; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
319 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
320 GtkWidget *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
321 GtkMdi *mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
322 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
323 gint x; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
324 gint y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
325 gint width; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
326 gint height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
327 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
328 GtkMdiChildState state; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
329 }; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
330 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
331 static void gtk_mdi_class_init(GtkMdiClass *klass); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
332 static void gtk_mdi_init(GtkMdi *mdi); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
333 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
334 static void gtk_mdi_realize(GtkWidget *widget); |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
335 static void gtk_mdi_size_allocate(GtkWidget *widget, GtkAllocation *allocation); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
336 #if 0 |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
337 static void gtk_mdi_size_request(GtkWidget *widget, GtkRequisition *requisition); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
338 static gint gtk_mdi_expose(GtkWidget *widget, GdkEventExpose *event); |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
339 #endif |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
340 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
341 /* Callbacks */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
342 static gboolean move_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
343 static gboolean resize_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
344 static gboolean iconify_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
345 static gboolean maximize_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
346 static gboolean kill_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
347 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
348 static void gtk_mdi_add(GtkContainer *container, GtkWidget *widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
349 static void gtk_mdi_remove_true(GtkContainer *container, GtkWidget *widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
350 static void gtk_mdi_forall(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
351 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
352 static GtkMdiChild *get_child(GtkMdi *mdi, GtkWidget * widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
353 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
354 static void _dw_log( char *format, ... ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
355 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
356 va_list args; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
357 va_start(args, format); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
358 if ( dbgfp != NULL ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
359 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
360 vfprintf( dbgfp, format, args ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
361 fflush( dbgfp ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
362 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
363 va_end(args); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
364 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
365 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
366 static GType gtk_mdi_get_type(void) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
367 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
368 static GType mdi_type = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
369 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
370 if (!mdi_type) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
371 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
372 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
373 static const GTypeInfo mdi_info = |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
374 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
375 sizeof (GtkMdiClass), |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
376 NULL, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
377 NULL, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
378 (GClassInitFunc) gtk_mdi_class_init, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
379 NULL, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
380 NULL, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
381 sizeof (GtkMdi), |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
382 0, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
383 (GInstanceInitFunc) gtk_mdi_init, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
384 }; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
385 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
386 mdi_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkMdi", &mdi_info, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
387 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
388 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
389 return mdi_type; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
390 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
391 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
392 /* Local data */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
393 static GtkWidgetClass *parent_class = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
394 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
395 static void gtk_mdi_class_init(GtkMdiClass *class) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
396 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
397 GObjectClass *object_class; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
398 GtkWidgetClass *widget_class; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
399 GtkContainerClass *container_class; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
400 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
401 object_class = (GObjectClass *) class; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
402 widget_class = (GtkWidgetClass *) class; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
403 container_class = (GtkContainerClass *) class; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
404 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
405 parent_class = g_type_class_ref (GTK_TYPE_CONTAINER); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
406 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
407 widget_class->realize = gtk_mdi_realize; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
408 #if 0 /* TODO */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
409 widget_class->expose_event = gtk_mdi_expose; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
410 widget_class->size_request = gtk_mdi_size_request; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
411 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
412 widget_class->size_allocate = gtk_mdi_size_allocate; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
413 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
414 container_class->add = gtk_mdi_add; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
415 container_class->remove = gtk_mdi_remove_true; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
416 container_class->forall = gtk_mdi_forall; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
417 class->mdi = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
418 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
419 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
420 static void gtk_mdi_init(GtkMdi *mdi) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
421 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
422 mdi->drag_button = -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
423 mdi->children = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
424 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
425 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
426 static GtkWidget *gtk_mdi_new(void) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
427 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
428 GtkWidget *mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
429 GdkColor background; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
430 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
431 mdi = GTK_WIDGET (g_object_new (gtk_mdi_get_type (), NULL)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
432 gdk_color_parse (GTK_MDI_BACKGROUND, &background); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
433 gtk_widget_modify_bg (mdi, GTK_STATE_NORMAL, &background); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
434 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
435 return mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
436 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
437 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
438 static void gtk_mdi_put(GtkMdi *mdi, GtkWidget *child_widget, gint x, gint y, GtkWidget *label) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
439 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
440 GtkMdiChild *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
441 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
442 GtkWidget *table; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
443 GtkWidget *button[3]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
444 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
445 GtkWidget *child_box; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
446 GtkWidget *top_event_box; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
447 GtkWidget *bottom_event_box; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
448 GtkWidget *child_widget_box; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
449 GtkWidget *image; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
450 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
451 GdkColor color; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
452 gint i, j; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
453 GdkCursor *cursor; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
454 GdkPixbuf *pixbuf; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
455 GtkStyle *style; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
456 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
457 child_box = gtk_event_box_new (); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
458 child_widget_box = gtk_event_box_new (); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
459 top_event_box = gtk_event_box_new (); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
460 bottom_event_box = gtk_event_box_new (); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
461 table = gtk_table_new (4, 7, FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
462 gtk_table_set_row_spacings (GTK_TABLE (table), 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
463 gtk_table_set_col_spacings (GTK_TABLE (table), 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
464 gtk_table_set_row_spacing (GTK_TABLE (table), 3, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
465 gtk_table_set_col_spacing (GTK_TABLE (table), 6, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
466 gtk_table_set_row_spacing (GTK_TABLE (table), 2, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
467 gtk_table_set_col_spacing (GTK_TABLE (table), 5, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
468 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
469 for (i = 0; i < 3; i++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
470 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
471 button[i] = gtk_event_box_new (); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
472 gtk_widget_set_events (button[0], GDK_BUTTON_PRESS_MASK); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
473 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
474 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
475 gdk_color_parse (GTK_MDI_LABEL_BACKGROUND, &color); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
476 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
477 gtk_widget_modify_bg (top_event_box, GTK_STATE_NORMAL, &color); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
478 gtk_widget_modify_bg (bottom_event_box, GTK_STATE_NORMAL, &color); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
479 gtk_widget_modify_bg (child_box, GTK_STATE_NORMAL, &color); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
480 for (i = GTK_STATE_NORMAL; i < GTK_STATE_ACTIVE; i++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
481 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
482 for (j = 0; j < 3; j++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
483 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
484 gtk_widget_modify_bg (button[j], i, &color); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
485 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
486 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
487 gdk_color_parse (GTK_MDI_LABEL_FOREGROUND, &color); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
488 gtk_widget_modify_fg (label, GTK_STATE_NORMAL, &color); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
489 gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
490 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
491 gtk_container_add (GTK_CONTAINER (top_event_box), label); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
492 gtk_container_add (GTK_CONTAINER (child_widget_box), child_widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
493 gtk_widget_set_size_request (bottom_event_box, 2, 2); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
494 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
495 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
496 style = gtk_widget_get_default_style (); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
497 pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **)minimize_xpm); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
498 image = gtk_image_new_from_pixbuf(pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
499 gtk_widget_show(image); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
500 gtk_container_add (GTK_CONTAINER (button[0]), image); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
501 pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **) maximize_xpm); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
502 image = gtk_image_new_from_pixbuf(pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
503 gtk_widget_show(image); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
504 gtk_container_add (GTK_CONTAINER (button[1]), image); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
505 pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **) kill_xpm); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
506 image = gtk_image_new_from_pixbuf(pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
507 gtk_widget_show(image); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
508 gtk_container_add (GTK_CONTAINER (button[2]), image); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
509 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
510 gtk_table_attach (GTK_TABLE (table), child_widget_box, 1, 6, 2, 3, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
511 GTK_EXPAND | GTK_SHRINK | GTK_FILL, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
512 GTK_EXPAND | GTK_SHRINK | GTK_FILL, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
513 0, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
514 gtk_table_attach (GTK_TABLE (table), top_event_box, 1, 2, 1, 2, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
515 GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
516 0, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
517 0, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
518 gtk_table_attach (GTK_TABLE (table), bottom_event_box, 6, 7, 3, 4, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
519 0, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
520 0, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
521 0, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
522 gtk_table_attach (GTK_TABLE (table), button[0], 2, 3, 1, 2, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
523 0, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
524 0, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
525 0, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
526 gtk_table_attach (GTK_TABLE (table), button[1], 3, 4, 1, 2, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
527 0, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
528 0, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
529 0, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
530 gtk_table_attach (GTK_TABLE (table), button[2], 4, 5, 1, 2, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
531 0, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
532 0, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
533 0, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
534 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
535 gtk_container_add (GTK_CONTAINER (child_box), table); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
536 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
537 child = g_new (GtkMdiChild, 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
538 child->widget = child_box; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
539 child->x = x; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
540 child->y = y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
541 child->width = -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
542 child->height = -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
543 child->child = child_widget; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
544 child->mdi = mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
545 child->state = CHILD_NORMAL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
546 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
547 gtk_widget_set_parent (child_box, GTK_WIDGET (mdi)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
548 mdi->children = g_list_append (mdi->children, child); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
549 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
550 gtk_widget_show (child_box); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
551 gtk_widget_show (table); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
552 gtk_widget_show (top_event_box); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
553 gtk_widget_show (bottom_event_box); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
554 gtk_widget_show (child_widget_box); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
555 for (i = 0; i < 3; i++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
556 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
557 gtk_widget_show (button[i]); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
558 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
559 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
560 cursor = gdk_cursor_new (GDK_HAND1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
561 gtk_widget_realize (top_event_box); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
562 gdk_window_set_cursor (gtk_widget_get_window(top_event_box), cursor); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
563 cursor = gdk_cursor_new (GDK_BOTTOM_RIGHT_CORNER); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
564 gtk_widget_realize (bottom_event_box); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
565 gdk_window_set_cursor (gtk_widget_get_window(bottom_event_box), cursor); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
566 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
567 g_signal_connect (G_OBJECT (top_event_box), "event", |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
568 G_CALLBACK (move_child_callback), |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
569 child); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
570 g_signal_connect (G_OBJECT (bottom_event_box), "event", |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
571 G_CALLBACK (resize_child_callback), |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
572 child); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
573 g_signal_connect (G_OBJECT (button[0]), "button_press_event", |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
574 G_CALLBACK (iconify_child_callback), |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
575 child); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
576 g_signal_connect (G_OBJECT (button[1]), "button_press_event", |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
577 G_CALLBACK (maximize_child_callback), |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
578 child); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
579 g_signal_connect (G_OBJECT (button[2]), "button_press_event", |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
580 G_CALLBACK (kill_child_callback), |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
581 child); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
582 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
583 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
584 static void gtk_mdi_move(GtkMdi *mdi, GtkWidget *widget, gint x, gint y) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
585 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
586 GtkMdiChild *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
587 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
588 g_return_if_fail(GTK_IS_MDI(mdi)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
589 g_return_if_fail(GTK_IS_WIDGET(widget)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
590 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
591 child = get_child(mdi, widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
592 g_return_if_fail(child); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
593 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
594 child->x = x; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
595 child->y = y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
596 if (gtk_widget_get_visible(widget) && gtk_widget_get_visible(GTK_WIDGET(mdi))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
597 gtk_widget_queue_resize(GTK_WIDGET(widget)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
598 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
599 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
600 static void gtk_mdi_get_pos(GtkMdi *mdi, GtkWidget *widget, gint *x, gint *y) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
601 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
602 GtkMdiChild *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
603 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
604 g_return_if_fail(GTK_IS_MDI (mdi)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
605 g_return_if_fail(GTK_IS_WIDGET (widget)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
606 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
607 child = get_child(mdi, widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
608 g_return_if_fail(child); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
609 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
610 *x = child->x; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
611 *y = child->y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
612 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
613 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
614 static void gtk_mdi_tile(GtkMdi *mdi) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
615 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
616 int i, n; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
617 int width, height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
618 GList *children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
619 GtkMdiChild *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
620 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
621 g_return_if_fail(GTK_IS_MDI(mdi)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
622 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
623 children = mdi->children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
624 n = g_list_length (children); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
625 width = gtk_widget_get_allocated_width(GTK_WIDGET (mdi)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
626 height = gtk_widget_get_allocated_height(GTK_WIDGET (mdi)) / n; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
627 for(i=0;i<n;i++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
628 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
629 child = (GtkMdiChild *) children->data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
630 children = children->next; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
631 child->x = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
632 child->y = i * height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
633 gtk_widget_set_size_request (child->widget, width, height); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
634 child->state = CHILD_NORMAL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
635 child->width = -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
636 child->height = -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
637 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
638 if (gtk_widget_get_visible(GTK_WIDGET (mdi))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
639 gtk_widget_queue_resize (GTK_WIDGET (mdi)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
640 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
641 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
642 static void gtk_mdi_cascade(GtkMdi *mdi) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
643 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
644 int i, n; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
645 int width, height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
646 GList *children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
647 GtkMdiChild *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
648 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
649 g_return_if_fail(GTK_IS_MDI(mdi)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
650 if(!gtk_widget_get_visible(GTK_WIDGET(mdi))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
651 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
652 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
653 children = mdi->children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
654 n = g_list_length (children); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
655 width = gtk_widget_get_allocated_width(GTK_WIDGET (mdi)) / (2 * n - 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
656 height = gtk_widget_get_allocated_height(GTK_WIDGET (mdi)) / (2 * n - 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
657 for (i = 0; i < n; i++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
658 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
659 child = (GtkMdiChild *) children->data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
660 children = children->next; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
661 child->x = i * width; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
662 child->y = i * height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
663 gtk_widget_set_size_request (child->widget, width * n, height * n); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
664 child->state = CHILD_NORMAL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
665 child->width = -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
666 child->height = -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
667 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
668 if (gtk_widget_get_visible(GTK_WIDGET(mdi))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
669 gtk_widget_queue_resize(GTK_WIDGET(mdi)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
670 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
671 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
672 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
673 static GtkMdiChildState gtk_mdi_get_state(GtkMdi *mdi, GtkWidget *widget) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
674 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
675 GtkMdiChild *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
676 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
677 g_return_val_if_fail (GTK_IS_MDI (mdi), CHILD_NORMAL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
678 g_return_val_if_fail (GTK_IS_WIDGET (widget), CHILD_NORMAL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
679 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
680 child = get_child (mdi, widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
681 g_return_val_if_fail (child, CHILD_NORMAL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
682 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
683 return child->state; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
684 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
685 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
686 static void gtk_mdi_set_state(GtkMdi *mdi, GtkWidget *widget, GtkMdiChildState state) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
687 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
688 GtkMdiChild *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
689 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
690 g_return_if_fail (GTK_IS_MDI (mdi)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
691 g_return_if_fail (GTK_IS_WIDGET (widget)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
692 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
693 child = get_child (mdi, widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
694 g_return_if_fail (child); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
695 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
696 child->state = state; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
697 if (gtk_widget_get_visible(child->widget) && gtk_widget_get_visible(GTK_WIDGET(mdi))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
698 gtk_widget_queue_resize(GTK_WIDGET(child->widget)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
699 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
700 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
701 static void gtk_mdi_remove(GtkMdi *mdi, GtkWidget *widget) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
702 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
703 GtkMdiChild *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
704 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
705 g_return_if_fail (GTK_IS_MDI (mdi)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
706 child = get_child (mdi, widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
707 g_return_if_fail (child); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
708 gtk_mdi_remove_true (GTK_CONTAINER (mdi), child->widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
709 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
710 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
711 static void gtk_mdi_realize(GtkWidget *widget) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
712 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
713 GtkMdi *mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
714 GdkWindowAttr attributes; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
715 gint attributes_mask; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
716 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
717 mdi = GTK_MDI (widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
718 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
719 g_return_if_fail (widget != NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
720 g_return_if_fail (GTK_IS_MDI (mdi)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
721 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
722 gtk_widget_set_realized(widget, TRUE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
723 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
724 GtkAllocation allocation; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
725 gtk_widget_get_allocation(widget, &allocation); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
726 attributes.x = allocation.x; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
727 attributes.y = allocation.y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
728 attributes.width = allocation.width; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
729 attributes.height = allocation.height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
730 attributes.wclass = GDK_INPUT_OUTPUT; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
731 attributes.window_type = GDK_WINDOW_CHILD; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
732 attributes.event_mask = gtk_widget_get_events (widget) | |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
733 GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
734 GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
735 GDK_POINTER_MOTION_HINT_MASK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
736 attributes.visual = gtk_widget_get_visual (widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
737 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
738 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
739 gtk_widget_set_parent_window(widget, gdk_window_new (gtk_widget_get_parent_window(widget), &attributes, attributes_mask)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
740 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
741 gtk_widget_set_style(widget, gtk_style_attach (gtk_widget_get_style(widget), gtk_widget_get_window(widget))); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
742 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
743 gdk_window_set_user_data (gtk_widget_get_window(widget), widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
744 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
745 gtk_style_set_background (gtk_widget_get_style(widget), gtk_widget_get_window(widget), GTK_STATE_NORMAL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
746 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
747 |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
748 #if 0 |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
749 static void gtk_mdi_size_request (GtkWidget *widget, GtkRequisition *requisition) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
750 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
751 GtkMdi *mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
752 GtkMdiChild *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
753 GList *children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
754 GtkRequisition child_requisition; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
755 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
756 mdi = GTK_MDI (widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
757 requisition->width = GTK_MDI_DEFAULT_WIDTH; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
758 requisition->height = GTK_MDI_DEFAULT_HEIGHT; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
759 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
760 children = mdi->children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
761 while(children) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
762 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
763 child = children->data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
764 children = children->next; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
765 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
766 if(gtk_widget_get_visible(child->widget)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
767 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
768 gtk_widget_size_request(child->widget, &child_requisition); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
769 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
770 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
771 } |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
772 #endif |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
773 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
774 static void gtk_mdi_size_allocate(GtkWidget *widget, GtkAllocation *allocation) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
775 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
776 GtkMdi *mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
777 GtkMdiChild *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
778 GtkAllocation child_allocation; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
779 GtkRequisition child_requisition; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
780 GList *children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
781 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
782 mdi = GTK_MDI (widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
783 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
784 gtk_widget_set_allocation(widget, allocation); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
785 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
786 if(gtk_widget_get_realized(widget)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
787 gdk_window_move_resize (gtk_widget_get_window(widget), |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
788 allocation->x, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
789 allocation->y, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
790 allocation->width, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
791 allocation->height); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
792 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
793 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
794 children = mdi->children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
795 while(children) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
796 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
797 child = children->data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
798 children = children->next; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
799 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
800 if(gtk_widget_get_visible(child->widget)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
801 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
802 gtk_widget_get_child_requisition (child->widget, &child_requisition); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
803 child_allocation.x = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
804 child_allocation.y = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
805 switch (child->state) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
806 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
807 case CHILD_NORMAL: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
808 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
809 if ((child->width < 0) && (child->height < 0)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
810 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
811 child_allocation.width = child_requisition.width; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
812 child_allocation.height = child_requisition.height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
813 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
814 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
815 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
816 child_allocation.width = child->width; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
817 child_allocation.height = child->height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
818 child->width = -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
819 child->height = -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
820 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
821 child_allocation.x += child->x; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
822 child_allocation.y += child->y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
823 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
824 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
825 case CHILD_MAXIMIZED: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
826 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
827 if ((child->width < 0) && (child->height < 0)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
828 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
829 child->width = child_requisition.width; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
830 child->height = child_requisition.height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
831 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
832 child_allocation.width = allocation->width; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
833 child_allocation.height = allocation->height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
834 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
835 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
836 case CHILD_ICONIFIED: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
837 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
838 if ((child->width < 0) && (child->height < 0)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
839 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
840 child->width = child_requisition.width; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
841 child->height = child_requisition.height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
842 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
843 child_allocation.x += child->x; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
844 child_allocation.y += child->y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
845 child_allocation.width = child_requisition.width; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
846 child_allocation.height = GTK_MDI_MIN_HEIGHT; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
847 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
848 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
849 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
850 gtk_widget_size_allocate (child->widget, &child_allocation); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
851 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
852 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
853 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
854 |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
855 #if 0 /* TODO: Is this needed... propogate expose is no longer supported */ |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
856 static gint gtk_mdi_expose(GtkWidget *widget, GdkEventExpose *event) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
857 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
858 GtkMdiChild *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
859 GList *children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
860 GtkMdi *mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
861 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
862 g_return_val_if_fail (widget != NULL, FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
863 g_return_val_if_fail (GTK_IS_MDI (widget), FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
864 g_return_val_if_fail (event != NULL, FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
865 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
866 mdi = GTK_MDI (widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
867 for (children = mdi->children; children; children = children->next) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
868 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
869 child = (GtkMdiChild *) children->data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
870 gtk_container_propagate_expose (GTK_CONTAINER (mdi), |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
871 child->widget, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
872 event); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
873 } |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
874 return FALSE; |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
875 } |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
876 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
877 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
878 static void gtk_mdi_add(GtkContainer *container, GtkWidget *widget) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
879 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
880 GtkWidget *label; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
881 label = gtk_label_new (""); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
882 gtk_mdi_put (GTK_MDI (container), widget, 0, 0, label); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
883 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
884 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
885 static void gtk_mdi_remove_true(GtkContainer *container, GtkWidget *widget) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
886 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
887 GtkMdi *mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
888 GtkMdiChild *child = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
889 GList *children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
890 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
891 mdi = GTK_MDI (container); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
892 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
893 children = mdi->children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
894 while (children) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
895 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
896 child = children->data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
897 if (child->widget == widget) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
898 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
899 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
900 children = children->next; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
901 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
902 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
903 if(child) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
904 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
905 gtk_widget_unparent (child->widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
906 g_free (child); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
907 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
908 mdi->children = g_list_remove_link (mdi->children, children); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
909 g_list_free (children); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
910 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
911 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
912 static void gtk_mdi_forall(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
913 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
914 GtkMdi *mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
915 GtkMdiChild *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
916 GList *children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
917 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
918 g_return_if_fail (callback != NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
919 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
920 mdi = GTK_MDI (container); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
921 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
922 children = mdi->children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
923 while (children) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
924 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
925 child = children->data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
926 children = children->next; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
927 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
928 (*callback) (child->widget, callback_data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
929 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
930 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
931 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
932 static gboolean move_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
933 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
934 GtkMdi *mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
935 GtkMdiChild *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
936 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
937 child = (GtkMdiChild *) data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
938 mdi = child->mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
939 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
940 g_return_val_if_fail (GTK_IS_MDI (mdi), FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
941 g_return_val_if_fail (GTK_IS_EVENT_BOX (widget), FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
942 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
943 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
944 switch (event->type) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
945 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
946 case GDK_2BUTTON_PRESS: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
947 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
948 gdk_window_raise (gtk_widget_get_window(child->widget)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
949 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
950 case GDK_BUTTON_PRESS: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
951 if (child->state == CHILD_MAXIMIZED) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
952 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
953 if (mdi->drag_button < 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
954 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
955 if (gdk_pointer_grab (event->button.window, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
956 FALSE, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
957 GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
958 GDK_BUTTON_RELEASE_MASK, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
959 NULL, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
960 NULL, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
961 event->button.time) != GDK_GRAB_SUCCESS) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
962 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
963 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
964 mdi->drag_button = event->button.button; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
965 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
966 mdi->drag_start.x = event->button.x; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
967 mdi->drag_start.y = event->button.y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
968 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
969 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
970 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
971 case GDK_BUTTON_RELEASE: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
972 if (mdi->drag_button < 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
973 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
974 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
975 if (mdi->drag_button == event->button.button) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
976 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
977 int x, y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
978 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
979 gdk_pointer_ungrab (event->button.time); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
980 mdi->drag_button = -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
981 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
982 x = event->button.x + child->x - mdi->drag_start.x; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
983 y = event->button.y + child->y - mdi->drag_start.y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
984 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
985 gtk_mdi_move (mdi, child->child, x, y); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
986 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
987 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
988 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
989 case GDK_MOTION_NOTIFY: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
990 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
991 int x, y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
992 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
993 if (mdi->drag_button < 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
994 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
995 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
996 gdk_window_get_pointer (gtk_widget_get_window(widget), &x, &y, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
997 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
998 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
999 x = x - mdi->drag_start.x + child->x; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1000 y = y - mdi->drag_start.y + child->y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1001 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1002 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1003 gtk_mdi_move (mdi, child->child, x, y); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1004 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1005 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1006 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1007 default: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1008 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1009 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1010 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1011 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1012 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1013 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1014 static gboolean resize_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1015 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1016 GtkMdi *mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1017 GtkMdiChild *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1018 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1019 child = (GtkMdiChild *) data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1020 mdi = child->mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1021 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1022 g_return_val_if_fail (GTK_IS_MDI (mdi), FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1023 g_return_val_if_fail (GTK_IS_EVENT_BOX (widget), FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1024 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1025 switch (event->type) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1026 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1027 case GDK_BUTTON_PRESS: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1028 if (mdi->drag_button < 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1029 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1030 if (gdk_pointer_grab (event->button.window, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1031 FALSE, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1032 GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1033 GDK_BUTTON_RELEASE_MASK, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1034 NULL, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1035 NULL, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1036 event->button.time) != GDK_GRAB_SUCCESS) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1037 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1038 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1039 mdi->drag_button = event->button.button; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1040 if ((child->state == CHILD_MAXIMIZED) || (child->state == CHILD_ICONIFIED)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1041 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1042 GtkAllocation allocation; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1043 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1044 child->state = CHILD_NORMAL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1045 gtk_widget_get_allocation(child->widget, &allocation); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1046 child->x = allocation.x; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1047 child->y = allocation.y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1048 child->width = allocation.width; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1049 child->height = allocation.height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1050 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1051 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1052 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1053 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1054 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1055 case GDK_BUTTON_RELEASE: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1056 if (mdi->drag_button < 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1057 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1058 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1059 if (mdi->drag_button == event->button.button) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1060 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1061 int width, height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1062 GtkAllocation allocation; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1063 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1064 gdk_pointer_ungrab (event->button.time); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1065 mdi->drag_button = -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1066 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1067 gtk_widget_get_allocation(widget, &allocation); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1068 width = event->button.x + allocation.x; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1069 height = event->button.y + allocation.y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1070 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1071 width = MAX (width, GTK_MDI_MIN_WIDTH); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1072 height = MAX (height, GTK_MDI_MIN_HEIGHT); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1073 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1074 gtk_widget_set_size_request (child->widget, width, height); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1075 gtk_widget_queue_resize (child->widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1076 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1077 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1078 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1079 case GDK_MOTION_NOTIFY: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1080 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1081 int x, y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1082 int width, height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1083 GtkAllocation allocation; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1084 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1085 if (mdi->drag_button < 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1086 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1087 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1088 gdk_window_get_pointer (gtk_widget_get_window(widget), &x, &y, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1089 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1090 gtk_widget_get_allocation(widget, &allocation); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1091 width = x + allocation.x; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1092 height = y + allocation.y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1093 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1094 width = MAX (width, GTK_MDI_MIN_WIDTH); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1095 height = MAX (height, GTK_MDI_MIN_HEIGHT); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1096 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1097 gtk_widget_set_size_request (child->widget, width, height); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1098 gtk_widget_queue_resize (child->widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1099 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1100 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1101 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1102 default: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1103 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1104 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1105 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1106 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1107 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1108 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1109 static gboolean iconify_child_callback (GtkWidget *widget, GdkEvent *event, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1110 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1111 GtkMdiChild *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1112 child = (GtkMdiChild *) data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1113 if(child->state == CHILD_ICONIFIED) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1114 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1115 child->state = CHILD_NORMAL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1116 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1117 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1118 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1119 child->state = CHILD_ICONIFIED; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1120 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1121 if(gtk_widget_get_visible(child->widget)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1122 gtk_widget_queue_resize(GTK_WIDGET (child->widget)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1123 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1124 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1125 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1126 static gboolean maximize_child_callback (GtkWidget *widget, GdkEvent * event, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1127 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1128 GtkMdiChild *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1129 child = (GtkMdiChild *) data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1130 if (child->state == CHILD_MAXIMIZED) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1131 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1132 child->state = CHILD_NORMAL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1133 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1134 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1135 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1136 child->state = CHILD_MAXIMIZED; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1137 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1138 if(gtk_widget_get_visible(child->widget)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1139 gtk_widget_queue_resize(GTK_WIDGET (child->widget)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1140 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1141 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1142 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1143 static gboolean kill_child_callback (GtkWidget *widget, GdkEvent *event, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1144 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1145 GtkMdiChild *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1146 GtkMdi *mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1147 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1148 child = (GtkMdiChild *) data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1149 mdi = child->mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1150 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1151 g_return_val_if_fail (GTK_IS_MDI (mdi), FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1152 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1153 gtk_mdi_remove_true (GTK_CONTAINER (mdi), child->widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1154 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1155 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1156 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1157 static GtkMdiChild *get_child (GtkMdi *mdi, GtkWidget *widget) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1158 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1159 GList *children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1160 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1161 children = mdi->children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1162 while (children) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1163 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1164 GtkMdiChild *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1165 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1166 child = children->data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1167 children = children->next; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1168 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1169 if (child->child == widget) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1170 return child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1171 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1172 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1173 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1174 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1175 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1176 static void _dw_msleep(long period) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1177 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1178 #ifdef __sun__ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1179 /* usleep() isn't threadsafe on Solaris */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1180 struct timespec req; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1181 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1182 req.tv_sec = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1183 req.tv_nsec = period * 10000000; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1184 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1185 nanosleep(&req, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1186 #else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1187 usleep(period * 1000); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1188 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1189 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1190 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1191 /* Finds the translation function for a given signal name */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1192 static void *_findsigfunc(char *signame) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1193 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1194 int z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1195 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1196 for(z=0;z<SIGNALMAX;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1197 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1198 if(strcasecmp(signame, SignalTranslate[z].name) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1199 return SignalTranslate[z].func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1200 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1201 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1202 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1203 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1204 static SignalHandler _get_signal_handler(GtkWidget *widget, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1205 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1206 int counter = (int)data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1207 SignalHandler sh; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1208 char text[100]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1209 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1210 sprintf(text, "_dw_sigwindow%d", counter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1211 sh.window = (HWND)g_object_get_data(G_OBJECT(widget), text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1212 sprintf(text, "_dw_sigfunc%d", counter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1213 sh.func = (void *)g_object_get_data(G_OBJECT(widget), text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1214 sprintf(text, "_dw_intfunc%d", counter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1215 sh.intfunc = (void *)g_object_get_data(G_OBJECT(widget), text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1216 sprintf(text, "_dw_sigdata%d", counter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1217 sh.data = g_object_get_data(G_OBJECT(widget), text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1218 sprintf(text, "_dw_sigcid%d", counter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1219 sh.cid = (gint)g_object_get_data(G_OBJECT(widget), text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1220 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1221 return sh; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1222 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1223 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1224 static void _remove_signal_handler(GtkWidget *widget, int counter) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1225 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1226 char text[100]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1227 gint cid; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1228 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1229 sprintf(text, "_dw_sigcid%d", counter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1230 cid = (gint)g_object_get_data(G_OBJECT(widget), text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1231 g_signal_handler_disconnect(G_OBJECT(widget), cid); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1232 g_object_set_data(G_OBJECT(widget), text, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1233 sprintf(text, "_dw_sigwindow%d", counter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1234 g_object_set_data(G_OBJECT(widget), text, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1235 sprintf(text, "_dw_sigfunc%d", counter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1236 g_object_set_data(G_OBJECT(widget), text, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1237 sprintf(text, "_dw_intfunc%d", counter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1238 g_object_set_data(G_OBJECT(widget), text, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1239 sprintf(text, "_dw_sigdata%d", counter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1240 g_object_set_data(G_OBJECT(widget), text, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1241 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1242 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1243 static int _set_signal_handler(GtkWidget *widget, HWND window, void *func, gpointer data, void *intfunc) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1244 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1245 int counter = (int)g_object_get_data(G_OBJECT(widget), "_dw_sigcounter"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1246 char text[100]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1247 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1248 sprintf(text, "_dw_sigwindow%d", counter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1249 g_object_set_data(G_OBJECT(widget), text, (gpointer)window); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1250 sprintf(text, "_dw_sigfunc%d", counter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1251 g_object_set_data(G_OBJECT(widget), text, (gpointer)func); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1252 sprintf(text, "_dw_intfunc%d", counter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1253 g_object_set_data(G_OBJECT(widget), text, (gpointer)intfunc); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1254 sprintf(text, "_dw_sigdata%d", counter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1255 g_object_set_data(G_OBJECT(widget), text, (gpointer)data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1256 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1257 counter++; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1258 g_object_set_data(G_OBJECT(widget), "_dw_sigcounter", GINT_TO_POINTER(counter)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1259 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1260 return counter - 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1261 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1262 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1263 static void _set_signal_handler_id(GtkWidget *widget, int counter, gint cid) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1264 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1265 char text[100]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1266 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1267 sprintf(text, "_dw_sigcid%d", counter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1268 g_object_set_data(G_OBJECT(widget), text, GINT_TO_POINTER(cid)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1269 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1270 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1271 static gint _set_focus_event(GtkWindow *window, GtkWidget *widget, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1272 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1273 SignalHandler work = _get_signal_handler((GtkWidget *)window, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1274 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1275 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1276 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1277 if(work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1278 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1279 int (*setfocusfunc)(HWND, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1280 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1281 retval = setfocusfunc(work.window, work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1282 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1283 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1284 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1285 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1286 static gint _button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1287 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1288 SignalHandler work = _get_signal_handler(widget, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1289 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1290 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1291 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1292 if(work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1293 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1294 int (*buttonfunc)(HWND, int, int, int, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1295 int mybutton = event->button; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1296 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1297 if(event->button == 3) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1298 mybutton = 2; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1299 else if(event->button == 2) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1300 mybutton = 3; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1301 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1302 retval = buttonfunc(work.window, event->x, event->y, mybutton, work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1303 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1304 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1305 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1306 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1307 static gint _button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1308 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1309 SignalHandler work = _get_signal_handler(widget, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1310 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1311 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1312 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1313 if(work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1314 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1315 int (*buttonfunc)(HWND, int, int, int, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1316 int mybutton = event->button; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1317 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1318 if(event->button == 3) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1319 mybutton = 2; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1320 else if(event->button == 2) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1321 mybutton = 3; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1322 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1323 retval = buttonfunc(work.window, event->x, event->y, mybutton, work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1324 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1325 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1326 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1327 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1328 static gint _motion_notify_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1329 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1330 SignalHandler work = _get_signal_handler(widget, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1331 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1332 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1333 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1334 if(work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1335 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1336 int (*motionfunc)(HWND, int, int, int, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1337 int keys = 0, x, y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1338 GdkModifierType state; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1339 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1340 if (event->is_hint) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1341 gdk_window_get_pointer (event->window, &x, &y, &state); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1342 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1343 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1344 x = event->x; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1345 y = event->y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1346 state = event->state; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1347 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1348 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1349 if (state & GDK_BUTTON1_MASK) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1350 keys = DW_BUTTON1_MASK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1351 if (state & GDK_BUTTON3_MASK) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1352 keys |= DW_BUTTON2_MASK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1353 if (state & GDK_BUTTON2_MASK) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1354 keys |= DW_BUTTON3_MASK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1355 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1356 retval = motionfunc(work.window, x, y, keys, work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1357 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1358 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1359 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1360 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1361 static gint _delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1362 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1363 SignalHandler work = _get_signal_handler(widget, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1364 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1365 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1366 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1367 if(work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1368 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1369 int (*closefunc)(HWND, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1370 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1371 retval = closefunc(work.window, work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1372 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1373 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1374 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1375 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1376 static gint _key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1377 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1378 SignalHandler work = _get_signal_handler(widget, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1379 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1380 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1381 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1382 if(work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1383 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1384 int (*keypressfunc)(HWND, char, int, int, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1385 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1386 retval = keypressfunc(work.window, *event->string, event->keyval, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1387 event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK), work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1388 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1389 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1390 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1391 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1392 static gint _generic_event(GtkWidget *widget, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1393 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1394 SignalHandler work = _get_signal_handler(widget, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1395 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1396 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1397 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1398 if(work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1399 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1400 int (*genericfunc)(HWND, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1401 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1402 retval = genericfunc(work.window, work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1403 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1404 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1405 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1406 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1407 static gint _activate_event(GtkWidget *widget, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1408 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1409 SignalHandler work = _get_signal_handler(widget, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1410 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1411 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1412 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1413 if(work.window && !_dw_ignore_click) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1414 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1415 int (*activatefunc)(HWND, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1416 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1417 retval = activatefunc(popup ? popup : work.window, work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1418 popup = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1419 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1420 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1421 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1422 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1423 static gint _configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1424 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1425 SignalHandler work = _get_signal_handler(widget, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1426 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1427 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1428 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1429 if(work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1430 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1431 int (*sizefunc)(HWND, int, int, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1432 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1433 retval = sizefunc(work.window, event->width, event->height, work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1434 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1435 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1436 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1437 |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
1438 static gint _expose_event(GtkWidget *widget, cairo_t *cr, gpointer data) |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1439 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1440 SignalHandler work = _get_signal_handler(widget, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1441 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1442 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1443 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1444 if(work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1445 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1446 DWExpose exp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1447 int (*exposefunc)(HWND, DWExpose *, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1448 |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
1449 exp.x = exp.y = 0; |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
1450 exp.width = egtk_widget_get_allocated_width(widget); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
1451 exp.height = gtk_widget_get_allocated_height(widget); |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1452 retval = exposefunc(work.window, &exp, work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1453 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1454 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1455 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1456 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1457 static gint _item_select_event(GtkWidget *widget, GtkWidget *child, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1458 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1459 SignalHandler work = _get_signal_handler(widget, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1460 static int _dw_recursing = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1461 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1462 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1463 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1464 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1465 if(_dw_recursing) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1466 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1467 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1468 if(work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1469 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1470 int (*selectfunc)(HWND, int, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1471 GList *list; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1472 int item = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1473 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1474 _dw_recursing = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1475 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1476 if(GTK_IS_COMBO_BOX(work.window)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1477 list = GTK_LIST(GTK_COMBO_BOX(work.window)->list)->children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1478 else if(GTK_IS_LIST(widget)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1479 list = GTK_LIST(widget)->children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1480 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1481 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1482 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1483 while(list) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1484 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1485 if(list->data == (gpointer)child) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1486 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1487 if(!g_object_get_data(G_OBJECT(work.window), "_dw_appending")) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1488 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1489 g_object_set_data(G_OBJECT(work.window), "_dw_item", GINT_TO_POINTER(item)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1490 if(selectfunc) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1491 retval = selectfunc(work.window, item, work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1492 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1493 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1494 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1495 item++; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1496 list = list->next; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1497 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1498 _dw_recursing = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1499 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1500 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1501 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1502 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1503 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1504 static gint _tree_context_event(GtkWidget *widget, GdkEventButton *event, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1505 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1506 SignalHandler work = _get_signal_handler(widget, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1507 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1508 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1509 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1510 if(work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1511 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1512 if(event->button == 3) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1513 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1514 int (*contextfunc)(HWND, char *, int, int, void *, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1515 char *text = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1516 void *itemdata = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1517 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1518 if(widget && GTK_IS_TREE_VIEW(widget)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1519 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1520 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1521 GtkTreeIter iter; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1522 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1523 if(sel && gtk_tree_selection_get_selected(sel, NULL, &iter)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1524 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1525 GtkTreeModel *store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1526 gtk_tree_model_get(store, &iter, 0, &text, 2, &itemdata, -1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1527 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1528 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1529 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1530 retval = contextfunc(work.window, text, event->x, event->y, work.data, itemdata); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1531 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1532 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1533 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1534 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1535 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1536 static gint _tree_select_event(GtkTreeSelection *sel, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1537 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1538 GtkWidget *item, *widget = (GtkWidget *)gtk_tree_selection_get_tree_view(sel); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1539 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1540 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1541 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1542 if(widget) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1543 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1544 SignalHandler work = _get_signal_handler(widget, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1545 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1546 if(work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1547 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1548 int (*treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1549 GtkTreeIter iter; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1550 char *text = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1551 void *itemdata = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1552 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1553 if(gtk_tree_selection_get_selected(sel, NULL, &iter)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1554 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1555 GtkTreeModel *store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1556 gtk_tree_model_get(store, &iter, 0, &text, 2, &itemdata, 3, &item, -1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1557 retval = treeselectfunc(work.window, (HTREEITEM)item, text, work.data, itemdata); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1558 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1559 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1560 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1561 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1562 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1563 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1564 static gint _tree_expand_event(GtkTreeView *widget, GtkTreeIter *iter, GtkTreePath *path, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1565 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1566 SignalHandler work = _get_signal_handler((GtkWidget *)widget, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1567 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1568 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1569 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1570 if(!_dw_ignore_expand && work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1571 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1572 int (*treeexpandfunc)(HWND, HTREEITEM, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1573 retval = treeexpandfunc(work.window, (HTREEITEM)iter, work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1574 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1575 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1576 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1577 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1578 static gint _container_select_event(GtkWidget *widget, GdkEventButton *event, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1579 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1580 SignalHandler work = _get_signal_handler(widget, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1581 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1582 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1583 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1584 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1585 if(work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1586 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1587 if(event->button == 1 && event->type == GDK_2BUTTON_PRESS) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1588 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1589 int (*contextfunc)(HWND, char *, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1590 char *text; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1591 int row, col; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1592 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1593 gtk_clist_get_selection_info(GTK_CLIST(widget), event->x, event->y, &row, &col); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1594 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1595 text = (char *)gtk_clist_get_row_data(GTK_CLIST(widget), row); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1596 retval = contextfunc(work.window, text, work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1597 g_object_set_data(G_OBJECT(widget), "_dw_double_click", GINT_TO_POINTER(1)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1598 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1599 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1600 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1601 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1602 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1603 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1604 static gint _container_enter_event(GtkWidget *widget, GdkEventKey *event, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1605 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1606 SignalHandler work = _get_signal_handler(widget, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1607 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1608 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1609 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1610 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1611 if(work.window && event->keyval == VK_RETURN) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1612 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1613 int (*contextfunc)(HWND, char *, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1614 char *text; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1615 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1616 text = (char *)gtk_clist_get_row_data(GTK_CLIST(widget), GTK_CLIST(widget)->focus_row); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1617 retval = contextfunc(work.window, text, work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1618 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1619 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1620 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1621 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1622 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1623 /* Return the logical page id from the physical page id */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1624 int _get_logical_page(HWND handle, unsigned long pageid) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1625 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1626 int z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1627 GtkWidget **pagearray = g_object_get_data(G_OBJECT(handle), "_dw_pagearray"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1628 GtkWidget *thispage = gtk_notebook_get_nth_page(GTK_NOTEBOOK(handle), pageid); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1629 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1630 if(pagearray && thispage) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1631 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1632 for(z=0;z<256;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1633 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1634 if(thispage == pagearray[z]) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1635 return z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1636 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1637 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1638 return 256; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1639 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1640 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1641 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1642 static gint _switch_page_event(GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1643 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1644 SignalHandler work = _get_signal_handler((GtkWidget *)notebook, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1645 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1646 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1647 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1648 if(work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1649 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1650 int (*switchpagefunc)(HWND, unsigned long, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1651 retval = switchpagefunc(work.window, _get_logical_page(GTK_WIDGET(notebook), page_num), work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1652 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1653 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1654 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1655 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1656 static gint _column_click_event(GtkWidget *widget, gint column_num, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1657 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1658 SignalHandler work = _get_signal_handler(widget, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1659 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1660 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1661 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1662 if(work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1663 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1664 int (*clickcolumnfunc)(HWND, int, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1665 retval = clickcolumnfunc(work.window, column_num, work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1666 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1667 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1668 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1669 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1670 static gint _container_select_row(GtkWidget *widget, gint row, gint column, GdkEventButton *event, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1671 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1672 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1673 SignalHandler work = _get_signal_handler(widget, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1674 char *rowdata = gtk_clist_get_row_data(GTK_CLIST(widget), row); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1675 int (*contextfunc)(HWND, HWND, char *, void *, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1676 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1677 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1678 if(!work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1679 return TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1680 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1681 if(g_object_get_data(G_OBJECT(widget), "_dw_double_click")) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1682 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1683 g_object_set_data(G_OBJECT(widget), "_dw_double_click", GINT_TO_POINTER(0)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1684 return TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1685 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1686 return contextfunc(work.window, 0, rowdata, work.data, 0);; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1687 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1688 return TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1689 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1690 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1691 static int _round_value(gfloat val) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1692 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1693 int newval = (int)val; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1694 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1695 if(val >= 0.5 + (gfloat)newval) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1696 newval++; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1697 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1698 return newval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1699 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1700 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1701 static gint _value_changed_event(GtkAdjustment *adjustment, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1702 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1703 int max = _round_value(gtk_adjustment_get_upper(adjustment)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1704 int val = _round_value(gtk_adjustment_get_value(adjustment)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1705 GtkWidget *slider = (GtkWidget *)g_object_get_data(G_OBJECT(adjustment), "_dw_slider"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1706 GtkWidget *spinbutton = (GtkWidget *)g_object_get_data(G_OBJECT(adjustment), "_dw_spinbutton"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1707 GtkWidget *scrollbar = (GtkWidget *)g_object_get_data(G_OBJECT(adjustment), "_dw_scrollbar"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1708 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1709 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1710 if (slider) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1711 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1712 SignalHandler work = _get_signal_handler((GtkWidget *)adjustment, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1713 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1714 if (work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1715 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1716 int (*valuechangedfunc)(HWND, int, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1717 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1718 if(GTK_IS_VSCALE(slider)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1719 valuechangedfunc(work.window, (max - val) - 1, work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1720 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1721 valuechangedfunc(work.window, val, work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1722 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1723 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1724 else if (scrollbar || spinbutton) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1725 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1726 SignalHandler work = _get_signal_handler((GtkWidget *)adjustment, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1727 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1728 if (work.window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1729 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1730 int (*valuechangedfunc)(HWND, int, void *) = work.func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1731 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1732 valuechangedfunc(work.window, val, work.data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1733 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1734 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1735 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1736 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1737 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1738 static gint _default_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1739 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1740 GtkWidget *next = (GtkWidget *)data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1741 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1742 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1743 if(next) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1744 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1745 if(event->keyval == GDK_KEY_Return) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1746 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1747 if(GTK_IS_BUTTON(next)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1748 g_signal_emit_by_name(G_OBJECT(next), "clicked"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1749 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1750 gtk_widget_grab_focus(next); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1751 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1752 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1753 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1754 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1755 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1756 static GdkPixbuf *_find_private_pixbuf(long id, unsigned long *userwidth, unsigned long *userheight) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1757 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1758 if(id < _PixmapCount && _PixmapArray[id].used) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1759 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1760 if(userwidth) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1761 *userwidth = _PixmapArray[id].width; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1762 if(userheight) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1763 *userheight = _PixmapArray[id].height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1764 return _PixmapArray[id].pixbuf; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1765 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1766 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1767 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1768 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1769 static GdkPixbuf *_find_pixbuf(long id, unsigned long *userwidth, unsigned long *userheight) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1770 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1771 char *data = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1772 int z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1773 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1774 if(id & (1 << 31)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1775 return _find_private_pixbuf((id & 0xFFFFFF), userwidth, userheight); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1776 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1777 for(z=0;z<_resources.resource_max;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1778 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1779 if(_resources.resource_id[z] == id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1780 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1781 data = _resources.resource_data[z]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1782 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1783 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1784 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1785 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1786 if(data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1787 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1788 GdkPixbuf *icon_pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1789 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1790 if(userwidth) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1791 *userwidth = gdk_pixbuf_get_width(icon_pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1792 if(userheight) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1793 *userheight = gdk_pixbuf_get_height(icon_pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1794 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1795 return icon_pixbuf; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1796 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1797 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1798 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1799 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1800 /* Find the index of a given thread */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1801 static int _find_thread_index(DWTID tid) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1802 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1803 int z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1804 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1805 for(z=0;z<DW_THREAD_LIMIT;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1806 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1807 if(_dw_thread_list[z] == tid) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1808 return z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1809 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1810 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1811 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1812 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1813 /* Add a thread id to the thread list */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1814 static void _dw_thread_add(DWTID tid) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1815 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1816 int z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1817 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1818 for(z=0;z<DW_THREAD_LIMIT;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1819 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1820 if(_dw_thread_list[z] == tid) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1821 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1822 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1823 if(_dw_thread_list[z] == (DWTID)-1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1824 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1825 _dw_thread_list[z] = tid; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1826 _foreground[z].pixel = _foreground[z].red =_foreground[z].green = _foreground[z].blue = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1827 _background[z].pixel = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1828 _background[z].red = _background[z].green = _background[z].blue = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1829 _transparent[z] = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1830 _clipboard_contents[z] = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1831 _clipboard_object[z] = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1832 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1833 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1834 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1835 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1836 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1837 /* Remove a thread id to the thread list */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1838 static void _dw_thread_remove(DWTID tid) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1839 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1840 int z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1841 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1842 for(z=0;z<DW_THREAD_LIMIT;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1843 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1844 if(_dw_thread_list[z] == (DWTID)tid) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1845 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1846 _dw_thread_list[z] = (DWTID)-1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1847 if ( _clipboard_contents[z] != NULL ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1848 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1849 g_free( _clipboard_contents[z] ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1850 _clipboard_contents[z] = NULL;; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1851 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1852 _clipboard_object[z] = NULL;; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1853 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1854 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1855 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1856 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1857 /* Try to load the mozilla embed shared libary */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1858 #ifdef USE_GTKMOZEMBED |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1859 #include <ctype.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1860 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1861 void init_mozembed(void) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1862 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1863 void *handle = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1864 gchar *profile; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1865 handle = dlopen( "libgtkembedmoz.so", RTLD_LAZY ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1866 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1867 /* If we loaded it, grab the symbols we want */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1868 if ( handle ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1869 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1870 _gtk_moz_embed_go_back = dlsym(handle, "gtk_moz_embed_go_back"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1871 _gtk_moz_embed_go_forward = dlsym(handle, "gtk_moz_embed_go_forward"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1872 _gtk_moz_embed_load_url = dlsym(handle, "gtk_moz_embed_load_url"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1873 _gtk_moz_embed_reload = dlsym(handle, "gtk_moz_embed_reload"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1874 _gtk_moz_embed_stop_load = dlsym(handle, "gtk_moz_embed_stop_load"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1875 _gtk_moz_embed_render_data = dlsym(handle, "gtk_moz_embed_render_data"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1876 _dw_moz_embed_get_type = dlsym(handle, "gtk_moz_embed_get_type"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1877 _gtk_moz_embed_new = dlsym(handle, "gtk_moz_embed_new"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1878 _gtk_moz_embed_can_go_back = dlsym(handle, "gtk_moz_embed_can_go_back"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1879 _gtk_moz_embed_can_go_forward = dlsym(handle, "gtk_moz_embed_can_go_forward"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1880 _gtk_moz_embed_set_comp_path = dlsym(handle, "gtk_moz_embed_set_comp_path"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1881 _gtk_moz_embed_set_profile_path = dlsym(handle, "gtk_moz_embed_set_profile_path"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1882 _gtk_moz_embed_push_startup = dlsym(handle, "gtk_moz_embed_push_startup"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1883 _gtk_moz_embed_set_comp_path( "/usr/lib/mozilla"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1884 _gtk_moz_embed_set_comp_path( "/usr/lib/firefox"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1885 profile = g_build_filename(g_get_home_dir(), ".dwindows/mozilla", NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1886 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1887 /* initialize profile */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1888 _gtk_moz_embed_set_profile_path(profile, "dwindows"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1889 g_free(profile); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1890 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1891 /* startup done */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1892 _gtk_moz_embed_push_startup(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1893 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1894 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1895 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1896 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1897 /* Try to load the libgtkhtml2 shared libary */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1898 #ifdef USE_LIBGTKHTML2 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1899 #include <ctype.h> |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1900 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1901 void init_libgtkhtml2 (void) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1902 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1903 void *handle = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1904 handle = dlopen( "libgtkhtml-2.so", RTLD_LAZY ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1905 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1906 /* If we loaded it, grab the symbols we want */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1907 if ( handle ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1908 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1909 _html_document_new = dlsym(handle, "html_document_new"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1910 _html_view_new = dlsym(handle, "html_view_new"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1911 //... |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1912 _gtk_html_context_get = dlsym(handle, "gtk_html_context_get" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1913 g_object_set( G_OBJECT(_gtk_html_context_get()), "debug_painting", FALSE, NULL ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1914 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1915 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1916 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1917 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1918 /* Try to load the WebKitGtk shared libary */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1919 #ifdef USE_WEBKIT |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1920 void init_webkit(void) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1921 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1922 char libname[100]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1923 void *handle = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1924 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1925 sprintf( libname, "lib%s.so", WEBKIT_LIB); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1926 handle = dlopen( libname, RTLD_LAZY ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1927 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1928 /* If we loaded it, grab the symbols we want */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1929 if ( handle ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1930 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1931 _webkit_web_view_get_type = dlsym( handle, "webkit_web_view_get_type" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1932 _webkit_web_view_load_html_string = dlsym( handle, "webkit_web_view_load_html_string" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1933 _webkit_web_view_open = dlsym( handle, "webkit_web_view_open" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1934 _webkit_web_view_new = dlsym( handle, "webkit_web_view_new" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1935 _webkit_web_view_go_back = dlsym( handle, "webkit_web_view_go_back" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1936 _webkit_web_view_go_forward = dlsym( handle, "webkit_web_view_go_forward" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1937 _webkit_web_view_reload = dlsym( handle, "webkit_web_view_reload" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1938 _webkit_web_view_stop_loading = dlsym( handle, "webkit_web_view_stop_loading" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1939 # ifdef WEBKIT_CHECK_VERSION |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1940 # if WEBKIT_CHECK_VERSION(1,1,5) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1941 _webkit_web_frame_print = dlsym( handle, "webkit_web_frame_print" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1942 _webkit_web_view_get_focused_frame = dlsym( handle, "webkit_web_view_get_focused_frame" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1943 # endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1944 # endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1945 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1946 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1947 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1948 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1949 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1950 * Initializes the Dynamic Windows engine. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1951 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1952 * newthread: True if this is the only thread. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1953 * False if there is already a message loop running. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1954 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1955 int dw_int_init(DWResources *res, int newthread, int *argc, char **argv[]) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1956 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1957 int z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1958 char *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1959 char *fname; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1960 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1961 if(res) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1962 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1963 _resources.resource_max = res->resource_max; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1964 _resources.resource_id = res->resource_id; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1965 _resources.resource_data = res->resource_data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1966 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1967 g_thread_init(NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1968 gdk_threads_init(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1969 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1970 gtk_init(argc, argv); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1971 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1972 tmp = getenv("DW_BORDER_WIDTH"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1973 if(tmp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1974 _dw_border_width = atoi(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1975 tmp = getenv("DW_BORDER_HEIGHT"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1976 if(tmp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1977 _dw_border_height = atoi(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1978 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1979 for(z=0;z<DW_THREAD_LIMIT;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1980 _dw_thread_list[z] = (DWTID)-1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1981 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1982 gtk_rc_parse_string("style \"gtk-tooltips-style\" { bg[NORMAL] = \"#eeee00\" } widget \"gtk-tooltips\" style \"gtk-tooltips-style\""); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1983 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1984 #ifdef USE_GTKMOZEMBED |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1985 init_mozembed(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1986 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1987 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1988 #ifdef USE_LIBGTKHTML2 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1989 init_libgtkhtml2(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1990 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1991 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1992 #ifdef USE_WEBKIT |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1993 init_webkit(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1994 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1995 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1996 * Setup logging/debugging |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1997 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1998 if ( (fname = getenv( "DWINDOWS_DEBUGFILE" ) ) != NULL ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1999 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2000 dbgfp = fopen( fname, "w" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2001 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2002 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2003 return TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2004 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2005 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2006 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2007 * Runs a message loop for Dynamic Windows. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2008 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2009 void dw_main(void) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2010 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2011 gdk_threads_enter(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2012 _dw_thread = pthread_self(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2013 _dw_thread_add(_dw_thread); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2014 gtk_main(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2015 _dw_thread = (pthread_t)-1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2016 gdk_threads_leave(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2017 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2018 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2019 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2020 * Runs a message loop for Dynamic Windows, for a period of milliseconds. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2021 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2022 * milliseconds: Number of milliseconds to run the loop for. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2023 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2024 void dw_main_sleep(int milliseconds) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2025 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2026 struct timeval tv, start; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2027 pthread_t curr = pthread_self(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2028 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2029 gettimeofday(&start, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2030 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2031 if(_dw_thread == (pthread_t)-1 || _dw_thread == curr) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2032 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2033 pthread_t orig = _dw_thread; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2034 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2035 gettimeofday(&tv, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2036 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2037 while(((tv.tv_sec - start.tv_sec)*1000) + ((tv.tv_usec - start.tv_usec)/1000) <= milliseconds) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2038 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2039 if(orig == (pthread_t)-1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2040 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2041 gdk_threads_enter(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2042 _dw_thread = curr; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2043 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2044 if(gtk_events_pending()) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2045 gtk_main_iteration(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2046 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2047 _dw_msleep(1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2048 if(orig == (pthread_t)-1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2049 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2050 _dw_thread = orig; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2051 gdk_threads_leave(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2052 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2053 gettimeofday(&tv, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2054 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2055 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2056 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2057 _dw_msleep(milliseconds); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2058 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2059 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2060 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2061 * Processes a single message iteration and returns. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2062 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2063 void dw_main_iteration(void) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2064 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2065 gdk_threads_enter(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2066 _dw_thread = pthread_self(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2067 _dw_thread_add(_dw_thread); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2068 gtk_main_iteration(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2069 _dw_thread = (pthread_t)-1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2070 gdk_threads_leave(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2071 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2072 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2073 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2074 * Free's memory allocated by dynamic windows. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2075 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2076 * ptr: Pointer to dynamic windows allocated |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2077 * memory to be free()'d. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2078 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2079 void dw_free(void *ptr) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2080 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2081 free(ptr); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2082 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2083 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2084 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2085 * Allocates and initializes a dialog struct. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2086 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2087 * data: User defined data to be passed to functions. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2088 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2089 DWDialog *dw_dialog_new(void *data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2090 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2091 DWDialog *tmp = malloc(sizeof(DWDialog)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2092 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2093 if ( tmp ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2094 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2095 tmp->eve = dw_event_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2096 dw_event_reset(tmp->eve); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2097 tmp->data = data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2098 tmp->done = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2099 tmp->method = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2100 tmp->result = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2101 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2102 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2103 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2104 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2105 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2106 * Accepts a dialog struct and returns the given data to the |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2107 * initial called of dw_dialog_wait(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2108 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2109 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2110 * result: Data to be returned by dw_dialog_wait(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2111 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2112 int dw_dialog_dismiss(DWDialog *dialog, void *result) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2113 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2114 dialog->result = result; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2115 if(dialog->method) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2116 gtk_main_quit(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2117 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2118 dw_event_post(dialog->eve); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2119 dialog->done = TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2120 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2121 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2122 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2123 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2124 * Accepts a dialog struct waits for dw_dialog_dismiss() to be |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2125 * called by a signal handler with the given dialog struct. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2126 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2127 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2128 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2129 void *dw_dialog_wait(DWDialog *dialog) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2130 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2131 void *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2132 int newprocess = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2133 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2134 /* _dw_thread will be -1 if dw_main hasn't been run yet. */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2135 if(_dw_thread == (pthread_t)-1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2136 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2137 _dw_thread = pthread_self(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2138 newprocess = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2139 gdk_threads_enter(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2140 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2141 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2142 if(pthread_self() == _dw_thread) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2143 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2144 dialog->method = TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2145 gtk_main(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2146 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2147 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2148 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2149 dialog->method = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2150 dw_event_wait(dialog->eve, -1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2151 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2152 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2153 if(newprocess) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2154 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2155 _dw_thread = (pthread_t)-1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2156 gdk_threads_leave(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2157 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2158 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2159 dw_event_close(&dialog->eve); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2160 tmp = dialog->result; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2161 free(dialog); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2162 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2163 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2164 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2165 static int _dw_ok_func(HWND window, void *data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2166 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2167 DWDialog *dwwait = (DWDialog *)data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2168 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2169 if(!dwwait) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2170 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2171 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2172 dw_window_destroy((HWND)dwwait->data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2173 dw_dialog_dismiss((DWDialog *)data, (void *)DW_MB_RETURN_OK); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2174 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2175 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2176 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2177 int _dw_yes_func(HWND window, void *data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2178 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2179 DWDialog *dwwait = (DWDialog *)data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2180 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2181 if(!dwwait) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2182 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2183 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2184 dw_window_destroy((HWND)dwwait->data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2185 dw_dialog_dismiss((DWDialog *)data, (void *)DW_MB_RETURN_YES); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2186 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2187 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2188 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2189 int _dw_no_func(HWND window, void *data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2190 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2191 DWDialog *dwwait = (DWDialog *)data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2192 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2193 if(!dwwait) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2194 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2195 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2196 dw_window_destroy((HWND)dwwait->data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2197 dw_dialog_dismiss((DWDialog *)data, (void *)DW_MB_RETURN_NO); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2198 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2199 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2200 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2201 int _dw_cancel_func(HWND window, void *data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2202 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2203 DWDialog *dwwait = (DWDialog *)data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2204 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2205 if(!dwwait) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2206 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2207 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2208 dw_window_destroy((HWND)dwwait->data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2209 dw_dialog_dismiss((DWDialog *)data, (void *)DW_MB_RETURN_CANCEL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2210 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2211 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2212 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2213 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2214 * Displays a Message Box with given text and title.. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2215 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2216 * title: The title of the message box. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2217 * flags: Defines buttons and icons to display |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2218 * format: printf style format string. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2219 * ...: Additional variables for use in the format. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2220 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2221 int dw_messagebox(char *title, int flags, char *format, ...) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2222 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2223 HWND entrywindow, texttargetbox, imagetextbox, mainbox, okbutton, nobutton, yesbutton, cancelbutton, buttonbox, stext; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2224 ULONG flStyle = DW_FCF_TITLEBAR | DW_FCF_SHELLPOSITION | DW_FCF_SIZEBORDER; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2225 DWDialog *dwwait; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2226 va_list args; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2227 char outbuf[1000]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2228 char **xpm_data = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2229 int x, y, extra_width=0,text_width,text_height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2230 int width,height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2231 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2232 va_start(args, format); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2233 vsnprintf(outbuf, 999, format, args); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2234 va_end(args); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2235 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2236 entrywindow = dw_window_new(HWND_DESKTOP, title, flStyle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2237 mainbox = dw_box_new(DW_VERT, 10); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2238 dw_box_pack_start(entrywindow, mainbox, 0, 0, TRUE, TRUE, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2239 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2240 /* determine if an icon is to be used - if so we need another HORZ box */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2241 if((flags & DW_MB_ERROR) | (flags & DW_MB_WARNING) | (flags & DW_MB_INFORMATION) | (flags & DW_MB_QUESTION)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2242 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2243 imagetextbox = dw_box_new(DW_HORZ, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2244 dw_box_pack_start(mainbox, imagetextbox, 0, 0, TRUE, TRUE, 2); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2245 texttargetbox = imagetextbox; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2246 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2247 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2248 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2249 imagetextbox = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2250 texttargetbox = mainbox; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2251 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2252 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2253 if(flags & DW_MB_ERROR) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2254 xpm_data = (char **)_dw_messagebox_error; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2255 else if(flags & DW_MB_WARNING) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2256 xpm_data = (char **)_dw_messagebox_warning; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2257 else if(flags & DW_MB_INFORMATION) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2258 xpm_data = (char **)_dw_messagebox_information; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2259 else if(flags & DW_MB_QUESTION) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2260 xpm_data = (char **)_dw_messagebox_question; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2261 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2262 if(xpm_data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2263 extra_width = 32; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2264 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2265 if(texttargetbox == imagetextbox) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2266 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2267 HWND handle = dw_bitmap_new( 100 ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2268 GdkPixbuf *icon_pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)xpm_data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2269 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2270 gtk_image_set_from_pixbuf(GTK_IMAGE(handle), icon_pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2271 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2272 dw_box_pack_start( texttargetbox, handle, 32, 32, FALSE, FALSE, 2); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2273 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2274 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2275 /* Create text */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2276 text_width = 240; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2277 text_height = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2278 stext = dw_text_new(outbuf, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2279 dw_window_set_style(stext, DW_DT_WORDBREAK, DW_DT_WORDBREAK); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2280 dw_font_text_extents_get(stext, NULL, outbuf, &width, &height); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2281 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2282 height = height+3; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2283 if(width < text_width) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2284 text_height = height*2; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2285 else if(width < text_width*2) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2286 text_height = height*3; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2287 else if(width < text_width*3) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2288 text_height = height*4; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2289 else /* width > (3*text_width) */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2290 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2291 text_width = (width / 3) + 60; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2292 text_height = height*4; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2293 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2294 #else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2295 text_width = min( width, dw_screen_width() - extra_width - 100 ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2296 text_height = min( height, dw_screen_height() ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2297 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2298 dw_box_pack_start(texttargetbox, stext, text_width, text_height, TRUE, TRUE, 2); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2299 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2300 /* Buttons */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2301 buttonbox = dw_box_new(DW_HORZ, 10); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2302 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2303 dw_box_pack_start(mainbox, buttonbox, 0, 0, TRUE, FALSE, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2304 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2305 dwwait = dw_dialog_new((void *)entrywindow); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2306 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2307 /* which buttons ? */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2308 if(flags & DW_MB_OK) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2309 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2310 okbutton = dw_button_new("Ok", 1001L); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2311 dw_box_pack_start(buttonbox, okbutton, 50, 30, TRUE, FALSE, 2); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2312 dw_signal_connect(okbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_ok_func), (void *)dwwait); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2313 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2314 else if(flags & DW_MB_OKCANCEL) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2315 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2316 okbutton = dw_button_new("Ok", 1001L); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2317 dw_box_pack_start(buttonbox, okbutton, 50, 30, TRUE, FALSE, 2); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2318 dw_signal_connect(okbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_ok_func), (void *)dwwait); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2319 cancelbutton = dw_button_new("Cancel", 1002L); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2320 dw_box_pack_start(buttonbox, cancelbutton, 50, 30, TRUE, FALSE, 2); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2321 dw_signal_connect(cancelbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_cancel_func), (void *)dwwait); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2322 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2323 else if(flags & DW_MB_YESNO) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2324 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2325 yesbutton = dw_button_new("Yes", 1001L); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2326 dw_box_pack_start(buttonbox, yesbutton, 50, 30, TRUE, FALSE, 2); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2327 dw_signal_connect(yesbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_yes_func), (void *)dwwait); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2328 nobutton = dw_button_new("No", 1002L); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2329 dw_box_pack_start(buttonbox, nobutton, 50, 30, TRUE, FALSE, 2); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2330 dw_signal_connect(nobutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_no_func), (void *)dwwait); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2331 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2332 else if(flags & DW_MB_YESNOCANCEL) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2333 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2334 yesbutton = dw_button_new("Yes", 1001L); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2335 dw_box_pack_start(buttonbox, yesbutton, 50, 30, TRUE, FALSE, 2); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2336 dw_signal_connect(yesbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_yes_func), (void *)dwwait); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2337 nobutton = dw_button_new("No", 1002L); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2338 dw_box_pack_start(buttonbox, nobutton, 50, 30, TRUE, FALSE, 2); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2339 dw_signal_connect(nobutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_no_func), (void *)dwwait); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2340 cancelbutton = dw_button_new("Cancel", 1003L); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2341 dw_box_pack_start(buttonbox, cancelbutton, 50, 30, TRUE, FALSE, 2); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2342 dw_signal_connect(cancelbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_cancel_func), (void *)dwwait); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2343 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2344 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2345 height = max(50,text_height)+100; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2346 x = ( - (text_width+60+extra_width))/2; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2347 y = (dw_screen_height() - height)/2; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2348 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2349 dw_window_set_pos_size(entrywindow, x, y, (text_width+60+extra_width), height); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2350 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2351 dw_window_show(entrywindow); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2352 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2353 return (int)dw_dialog_wait(dwwait); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2354 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2355 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2356 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2357 * Minimizes or Iconifies a top-level window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2358 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2359 * handle: The window handle to minimize. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2360 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2361 int dw_window_minimize(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2362 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2363 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2364 GtkWidget *mdi = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2365 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2366 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2367 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2368 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2369 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2370 if((mdi = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_mdi")) && GTK_IS_MDI(mdi)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2371 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2372 gtk_mdi_set_state(GTK_MDI(mdi), handle, CHILD_ICONIFIED); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2373 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2374 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2375 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2376 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2377 XIconifyWindow(GDK_WINDOW_XDISPLAY(GTK_WIDGET(handle)->window), |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2378 GDK_WINDOW_XWINDOW(GTK_WIDGET(handle)->window), |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2379 DefaultScreen (GDK_DISPLAY ())); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2380 #else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2381 gtk_window_iconify( GTK_WINDOW(handle) ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2382 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2383 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2384 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2385 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2386 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2387 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2388 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2389 * Makes the window topmost. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2390 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2391 * handle: The window handle to make topmost. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2392 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2393 int dw_window_raise(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2394 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2395 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2396 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2397 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2398 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2399 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2400 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2401 gdk_window_raise(gtk_widget_get_window(GTK_WIDGET(handle))); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2402 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2403 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2404 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2405 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2406 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2407 * Makes the window bottommost. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2408 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2409 * handle: The window handle to make bottommost. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2410 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2411 int dw_window_lower(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2412 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2413 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2414 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2415 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2416 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2417 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2418 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2419 gdk_window_lower(gtk_widget_get_window(GTK_WIDGET(handle))); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2420 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2421 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2422 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2423 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2424 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2425 * Makes the window visible. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2426 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2427 * handle: The window handle to make visible. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2428 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2429 int dw_window_show(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2430 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2431 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2432 GtkWidget *defaultitem; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2433 GtkWidget *mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2434 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2435 if (!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2436 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2437 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2438 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2439 gtk_widget_show(handle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2440 if ((mdi = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_mdi")) && GTK_IS_MDI(mdi)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2441 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2442 gtk_mdi_set_state(GTK_MDI(mdi), handle, CHILD_NORMAL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2443 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2444 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2445 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2446 if (gtk_widget_get_window(GTK_WIDGET(handle))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2447 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2448 int width = (int)g_object_get_data(G_OBJECT(handle), "_dw_width"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2449 int height = (int)g_object_get_data(G_OBJECT(handle), "_dw_height"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2450 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2451 if (width && height) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2452 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2453 gtk_widget_set_size_request(handle, width, height); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2454 g_object_set_data(G_OBJECT(handle), "_dw_width", GINT_TO_POINTER(0)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2455 g_object_set_data(G_OBJECT(handle), "_dw_height", GINT_TO_POINTER(0)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2456 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2457 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2458 gdk_window_raise(gtk_widget_get_window(GTK_WIDGET(handle))); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2459 gdk_flush(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2460 gdk_window_show(gtk_widget_get_window(GTK_WIDGET(handle))); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2461 gdk_flush(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2462 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2463 defaultitem = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_defaultitem"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2464 if (defaultitem) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2465 gtk_widget_grab_focus(defaultitem); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2466 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2467 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2468 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2469 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2470 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2471 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2472 * Makes the window invisible. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2473 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2474 * handle: The window handle to make visible. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2475 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2476 int dw_window_hide(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2477 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2478 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2479 GtkWidget *mdi = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2480 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2481 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2482 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2483 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2484 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2485 if((mdi = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_mdi")) && GTK_IS_MDI(mdi)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2486 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2487 gtk_mdi_set_state(GTK_MDI(mdi), handle, CHILD_ICONIFIED); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2488 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2489 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2490 gtk_widget_hide(handle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2491 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2492 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2493 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2494 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2495 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2496 * Destroys a window and all of it's children. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2497 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2498 * handle: The window handle to destroy. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2499 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2500 int dw_window_destroy(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2501 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2502 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2503 GtkWidget *mdi = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2504 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2505 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2506 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2507 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2508 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2509 if((mdi = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_mdi")) && GTK_IS_MDI(mdi)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2510 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2511 gtk_mdi_remove(GTK_MDI(mdi), handle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2512 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2513 if(GTK_IS_WIDGET(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2514 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2515 GtkWidget *eventbox = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_eventbox"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2516 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2517 if(eventbox && GTK_IS_WIDGET(eventbox)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2518 gtk_widget_destroy(eventbox); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2519 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2520 gtk_widget_destroy(handle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2521 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2522 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2523 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2524 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2525 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2526 /* Causes entire window to be invalidated and redrawn. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2527 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2528 * handle: Toplevel window handle to be redrawn. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2529 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2530 void dw_window_redraw(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2531 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2532 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2533 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2534 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2535 * Changes a window's parent to newparent. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2536 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2537 * handle: The window handle to destroy. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2538 * newparent: The window's new parent window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2539 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2540 void dw_window_reparent(HWND handle, HWND newparent) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2541 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2542 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2543 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2544 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2545 gdk_window_reparent(gtk_widget_get_window(GTK_WIDGET(handle)), newparent ? gtk_widget_get_window(GTK_WIDGET(newparent)) : GDK_ROOT_WINDOW(), 0, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2546 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2547 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2548 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2549 static int _set_font(HWND handle, char *fontname) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2550 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2551 int retval = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2552 PangoFontDescription *font = pango_font_description_from_string(fontname); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2553 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2554 if(font) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2555 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2556 gtk_widget_modify_font(handle, font); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2557 pango_font_description_free(font); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2558 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2559 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2560 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2561 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2562 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2563 * Sets the font used by a specified window (widget) handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2564 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2565 * handle: The window (widget) handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2566 * fontname: Name and size of the font in the form "size.fontname" |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2567 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2568 int dw_window_set_font(HWND handle, char *fontname) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2569 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2570 PangoFontDescription *pfont; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2571 GtkWidget *handle2 = handle; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2572 char *font; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2573 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2574 gpointer data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2575 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2576 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2577 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2578 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2579 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2580 if(tmp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2581 handle2 = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2582 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2583 font = strdup(fontname); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2584 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2585 /* Free old font name if one is allocated */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2586 data = g_object_get_data(G_OBJECT(handle2), "_dw_fontname"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2587 if(data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2588 free(data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2589 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2590 g_object_set_data(G_OBJECT(handle2), "_dw_fontname", (gpointer)font); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2591 pfont = pango_font_description_from_string(fontname); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2592 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2593 if(pfont) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2594 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2595 gtk_widget_modify_font(handle2, pfont); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2596 pango_font_description_free(pfont); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2597 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2598 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2599 return TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2600 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2601 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2602 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2603 * Gets the font used by a specified window (widget) handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2604 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2605 * handle: The window (widget) handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2606 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2607 char *dw_window_get_font(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2608 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2609 PangoFontDescription *pfont; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2610 PangoContext *pcontext; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2611 GtkWidget *handle2 = handle; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2612 char *font; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2613 char *retfont=NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2614 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2615 gpointer data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2616 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2617 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2618 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2619 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2620 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2621 if(tmp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2622 handle2 = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2623 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2624 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2625 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2626 /* Free old font name if one is allocated */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2627 data = g_object_get_data(G_OBJECT(handle2), "_dw_fontname"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2628 if(data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2629 free(data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2630 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2631 g_object_set_data(G_OBJECT(handle2), "_dw_fontname", (gpointer)font); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2632 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2633 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2634 pcontext = gtk_widget_get_pango_context( handle2 ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2635 if ( pcontext ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2636 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2637 pfont = pango_context_get_font_description( pcontext ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2638 if ( pfont ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2639 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2640 font = pango_font_description_to_string( pfont ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2641 retfont = strdup(font); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2642 g_free( font ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2643 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2644 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2645 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2646 return retfont; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2647 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2648 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2649 void _free_gdk_colors(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2650 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2651 GdkColor *old = (GdkColor *)g_object_get_data(G_OBJECT(handle), "_dw_foregdk"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2652 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2653 if(old) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2654 free(old); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2655 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2656 old = (GdkColor *)g_object_get_data(G_OBJECT(handle), "_dw_backgdk"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2657 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2658 if(old) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2659 free(old); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2660 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2661 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2662 /* Free old color pointers and allocate new ones */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2663 static void _save_gdk_colors(HWND handle, GdkColor fore, GdkColor back) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2664 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2665 GdkColor *foregdk = malloc(sizeof(GdkColor)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2666 GdkColor *backgdk = malloc(sizeof(GdkColor)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2667 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2668 _free_gdk_colors(handle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2669 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2670 *foregdk = fore; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2671 *backgdk = back; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2672 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2673 g_object_set_data(G_OBJECT(handle), "_dw_foregdk", (gpointer)foregdk); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2674 g_object_set_data(G_OBJECT(handle), "_dw_backgdk", (gpointer)backgdk); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2675 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2676 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2677 static int _set_color(HWND handle, unsigned long fore, unsigned long back) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2678 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2679 /* Remember that each color component in X11 use 16 bit no matter |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2680 * what the destination display supports. (and thus GDK) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2681 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2682 GdkColor forecolor, backcolor; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2683 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2684 if(fore & DW_RGB_COLOR) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2685 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2686 forecolor.pixel = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2687 forecolor.red = DW_RED_VALUE(fore) << 8; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2688 forecolor.green = DW_GREEN_VALUE(fore) << 8; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2689 forecolor.blue = DW_BLUE_VALUE(fore) << 8; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2690 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2691 gtk_widget_modify_text(handle, 0, &forecolor); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2692 gtk_widget_modify_text(handle, 1, &forecolor); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2693 gtk_widget_modify_fg(handle, 0, &forecolor); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2694 gtk_widget_modify_fg(handle, 1, &forecolor); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2695 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2696 else if(fore != DW_CLR_DEFAULT) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2697 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2698 forecolor = _colors[fore]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2699 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2700 gtk_widget_modify_text(handle, 0, &_colors[fore]); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2701 gtk_widget_modify_text(handle, 1, &_colors[fore]); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2702 gtk_widget_modify_fg(handle, 0, &_colors[fore]); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2703 gtk_widget_modify_fg(handle, 1, &_colors[fore]); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2704 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2705 if(back & DW_RGB_COLOR) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2706 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2707 backcolor.pixel = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2708 backcolor.red = DW_RED_VALUE(back) << 8; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2709 backcolor.green = DW_GREEN_VALUE(back) << 8; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2710 backcolor.blue = DW_BLUE_VALUE(back) << 8; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2711 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2712 gtk_widget_modify_base(handle, 0, &backcolor); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2713 gtk_widget_modify_base(handle, 1, &backcolor); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2714 gtk_widget_modify_bg(handle, 0, &backcolor); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2715 gtk_widget_modify_bg(handle, 1, &backcolor); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2716 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2717 else if(back != DW_CLR_DEFAULT) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2718 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2719 backcolor = _colors[back]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2720 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2721 gtk_widget_modify_base(handle, 0, &_colors[back]); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2722 gtk_widget_modify_base(handle, 1, &_colors[back]); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2723 gtk_widget_modify_bg(handle, 0, &_colors[back]); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2724 gtk_widget_modify_bg(handle, 1, &_colors[back]); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2725 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2726 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2727 _save_gdk_colors(handle, forecolor, backcolor); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2728 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2729 return TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2730 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2731 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2732 * Sets the colors used by a specified window (widget) handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2733 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2734 * handle: The window (widget) handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2735 * fore: Foreground color in RGB format. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2736 * back: Background color in RGB format. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2737 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2738 int dw_window_set_color(HWND handle, unsigned long fore, unsigned long back) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2739 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2740 GtkWidget *handle2 = handle; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2741 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2742 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2743 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2744 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2745 if(GTK_IS_SCROLLED_WINDOW(handle) || GTK_IS_BOX(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2746 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2747 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2748 if(tmp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2749 handle2 = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2750 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2751 else if(GTK_IS_TABLE(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2752 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2753 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_eventbox"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2754 if(tmp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2755 handle2 = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2756 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2757 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2758 _set_color(handle2, fore, back); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2759 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2760 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2761 return TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2762 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2763 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2764 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2765 * Sets the font used by a specified window (widget) handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2766 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2767 * handle: The window (widget) handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2768 * border: Size of the window border in pixels. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2769 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2770 int dw_window_set_border(HWND handle, int border) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2771 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2772 /* TODO */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2773 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2774 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2775 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2776 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2777 * Captures the mouse input to this window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2778 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2779 * handle: Handle to receive mouse input. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2780 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2781 void dw_window_capture(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2782 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2783 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2784 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2785 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2786 gdk_pointer_grab(gtk_widget_get_window(handle), TRUE, GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK, NULL, NULL, GDK_CURRENT_TIME); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2787 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2788 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2789 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2790 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2791 * Changes the appearance of the mouse pointer. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2792 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2793 * handle: Handle to widget for which to change. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2794 * cursortype: ID of the pointer you want. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2795 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2796 void dw_window_set_pointer(HWND handle, int pointertype) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2797 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2798 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2799 GdkCursor *cursor; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2800 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2801 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2802 if(pointertype & (1 << 31)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2803 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2804 GdkPixbuf *pixbuf = _find_private_pixbuf((pointertype & 0xFFFFFF), NULL, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2805 cursor = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), pixbuf, 8, 8); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2806 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2807 else if(!pointertype) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2808 cursor = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2809 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2810 cursor = gdk_cursor_new(pointertype); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2811 if(handle && gtk_widget_get_window(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2812 gdk_window_set_cursor(gtk_widget_get_window(handle), cursor); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2813 if(cursor) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2814 gdk_cursor_unref(cursor); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2815 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2816 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2817 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2818 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2819 * Releases previous mouse capture. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2820 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2821 void dw_window_release(void) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2822 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2823 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2824 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2825 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2826 gdk_pointer_ungrab(GDK_CURRENT_TIME); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2827 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2828 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2829 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2830 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2831 * Create a new Window Frame. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2832 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2833 * owner: The Owner's window handle or HWND_DESKTOP. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2834 * title: The Window title. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2835 * flStyle: Style flags, see the PM reference. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2836 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2837 HWND dw_window_new(HWND hwndOwner, char *title, unsigned long flStyle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2838 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2839 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2840 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2841 int flags = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2842 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2843 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2844 if(hwndOwner && GTK_IS_MDI(hwndOwner)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2845 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2846 GtkWidget *label; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2847 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2848 tmp = dw_box_new(DW_VERT, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2849 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2850 label = gtk_label_new(title); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2851 gtk_widget_show(label); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2852 g_object_set_data(G_OBJECT(tmp), "_dw_mdi_child", GINT_TO_POINTER(1)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2853 g_object_set_data(G_OBJECT(tmp), "_dw_mdi_title", (gpointer)label); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2854 g_object_set_data(G_OBJECT(tmp), "_dw_mdi", (gpointer)hwndOwner); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2855 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2856 gtk_mdi_put(GTK_MDI(hwndOwner), tmp, 100, 75, label); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2857 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2858 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2859 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2860 last_window = tmp = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2861 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2862 gtk_window_set_title(GTK_WINDOW(tmp), title); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2863 if(!(flStyle & DW_FCF_SIZEBORDER)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2864 gtk_window_set_resizable(GTK_WINDOW(tmp), FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2865 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2866 gtk_widget_realize(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2867 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2868 if(flStyle & DW_FCF_TITLEBAR) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2869 flags |= GDK_DECOR_TITLE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2870 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2871 if(flStyle & DW_FCF_MINMAX) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2872 flags |= GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2873 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2874 if(flStyle & DW_FCF_SIZEBORDER) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2875 flags |= GDK_DECOR_RESIZEH | GDK_DECOR_BORDER; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2876 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2877 if(flStyle & DW_FCF_BORDER || flStyle & DW_FCF_DLGBORDER) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2878 flags |= GDK_DECOR_BORDER; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2879 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2880 if(flStyle & DW_FCF_MAXIMIZE) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2881 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2882 flags &= ~DW_FCF_MAXIMIZE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2883 gtk_window_maximize(GTK_WINDOW(tmp)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2884 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2885 if(flStyle & DW_FCF_MINIMIZE) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2886 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2887 flags &= ~DW_FCF_MINIMIZE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2888 gtk_window_iconify(GTK_WINDOW(tmp)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2889 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2890 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2891 gdk_window_set_decorations(gtk_widget_get_window(tmp), flags); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2892 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2893 if(hwndOwner) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2894 gdk_window_reparent(gtk_widget_get_window(GTK_WIDGET(tmp)), gtk_widget_get_window(GTK_WIDGET(hwndOwner)), 0, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2895 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2896 if(flStyle & DW_FCF_SIZEBORDER) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2897 g_object_set_data(G_OBJECT(tmp), "_dw_size", GINT_TO_POINTER(1)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2898 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2899 g_object_set_data(G_OBJECT(tmp), "_dw_style", GINT_TO_POINTER(flStyle)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2900 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2901 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2902 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2903 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2904 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2905 * Create a new Box to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2906 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2907 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2908 * pad: Number of pixels to pad around the box. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2909 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2910 HWND dw_box_new(int type, int pad) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2911 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2912 GtkWidget *tmp, *eventbox; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2913 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2914 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2915 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2916 tmp = gtk_table_new(1, 1, FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2917 eventbox = gtk_event_box_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2918 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2919 gtk_widget_show(eventbox); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2920 g_object_set_data(G_OBJECT(tmp), "_dw_eventbox", (gpointer)eventbox); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2921 g_object_set_data(G_OBJECT(tmp), "_dw_boxtype", GINT_TO_POINTER(type)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2922 g_object_set_data(G_OBJECT(tmp), "_dw_boxpad", GINT_TO_POINTER(pad)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2923 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2924 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2925 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2926 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2927 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2928 #ifndef INCOMPLETE |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2929 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2930 * Create a new scrollable Box to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2931 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2932 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2933 * pad: Number of pixels to pad around the box. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2934 * This works fine under GTK+, but is incomplete on other platforms |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2935 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2936 HWND dw_scrollbox_new( int type, int pad ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2937 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2938 GtkWidget *tmp, *box, *eventbox; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2939 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2940 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2941 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2942 tmp = gtk_scrolled_window_new(NULL, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2943 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (tmp), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2944 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2945 box = gtk_table_new(1, 1, FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2946 eventbox = gtk_event_box_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2947 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2948 gtk_widget_show(eventbox); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2949 g_object_set_data(G_OBJECT(box), "_dw_eventbox", (gpointer)eventbox); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2950 g_object_set_data(G_OBJECT(box), "_dw_boxtype", GINT_TO_POINTER(type)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2951 g_object_set_data(G_OBJECT(box), "_dw_boxpad", GINT_TO_POINTER(pad)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2952 g_object_set_data(G_OBJECT(tmp), "_dw_boxhandle", (gpointer)box); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2953 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2954 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(tmp),box); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2955 g_object_set_data(G_OBJECT(tmp), "_dw_user", box); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2956 gtk_widget_show(box); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2957 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2958 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2959 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2960 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2961 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2962 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2963 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2964 * Returns the position of the scrollbar in the scrollbox |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2965 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2966 * handle: Handle to the scrollbox to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2967 * orient: The vertical or horizontal scrollbar. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2968 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2969 int dw_scrollbox_get_pos(HWND handle, int orient) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2970 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2971 int val = -1, _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2972 GtkAdjustment *adjustment; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2973 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2974 if (!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2975 return -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2976 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2977 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2978 if ( orient == DW_HORZ ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2979 adjustment = gtk_scrolled_window_get_hadjustment( GTK_SCROLLED_WINDOW(handle) ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2980 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2981 adjustment = gtk_scrolled_window_get_vadjustment( GTK_SCROLLED_WINDOW(handle) ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2982 if (adjustment) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2983 val = _round_value(gtk_adjustment_get_value(adjustment)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2984 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2985 return val; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2986 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2987 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2988 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2989 * Gets the range for the scrollbar in the scrollbox. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2990 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2991 * handle: Handle to the scrollbox to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2992 * orient: The vertical or horizontal scrollbar. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2993 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2994 int API dw_scrollbox_get_range(HWND handle, int orient) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2995 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2996 int range = -1, _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2997 GtkAdjustment *adjustment; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2998 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2999 if (!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3000 return -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3001 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3002 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3003 if ( orient == DW_HORZ ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3004 adjustment = gtk_scrolled_window_get_hadjustment( GTK_SCROLLED_WINDOW(handle) ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3005 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3006 adjustment = gtk_scrolled_window_get_vadjustment( GTK_SCROLLED_WINDOW(handle) ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3007 if (adjustment) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3008 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3009 range = _round_value(gtk_adjustment_get_upper(adjustment)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3010 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3011 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3012 return range; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3013 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3014 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3015 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3016 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3017 * Create a new Group Box to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3018 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3019 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3020 * pad: Number of pixels to pad around the box. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3021 * title: Text to be displayined in the group outline. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3022 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3023 HWND dw_groupbox_new(int type, int pad, char *title) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3024 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3025 GtkWidget *tmp, *frame, *label; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3026 PangoFontDescription *pfont; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3027 PangoContext *pcontext; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3028 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3029 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3030 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3031 frame = gtk_frame_new(NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3032 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3033 gtk_frame_set_label(GTK_FRAME(frame), title && *title ? title : NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3034 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3035 * Get the current font for the frame's label and make it bold |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3036 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3037 label = gtk_frame_get_label_widget(GTK_FRAME(frame)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3038 pcontext = gtk_widget_get_pango_context( label ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3039 if ( pcontext ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3040 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3041 pfont = pango_context_get_font_description( pcontext ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3042 if ( pfont ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3043 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3044 pango_font_description_set_weight( pfont, PANGO_WEIGHT_BOLD ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3045 gtk_widget_modify_font( label, pfont ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3046 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3047 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3048 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3049 tmp = gtk_table_new(1, 1, FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3050 gtk_container_set_border_width(GTK_CONTAINER(tmp), pad); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3051 g_object_set_data(G_OBJECT(tmp), "_dw_boxtype", GINT_TO_POINTER(type)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3052 g_object_set_data(G_OBJECT(tmp), "_dw_boxpad", GINT_TO_POINTER(pad)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3053 g_object_set_data(G_OBJECT(frame), "_dw_boxhandle", (gpointer)tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3054 gtk_container_add(GTK_CONTAINER(frame), tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3055 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3056 gtk_widget_show(frame); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3057 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3058 return frame; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3059 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3060 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3061 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3062 * Create a new MDI Frame to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3063 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3064 * id: An ID to be used with dw_window_from_id or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3065 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3066 HWND dw_mdi_new(unsigned long id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3067 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3068 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3069 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3070 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3071 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3072 tmp = gtk_mdi_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3073 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3074 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3075 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3076 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3077 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3078 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3079 * Create a bitmap object to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3080 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3081 * id: An ID to be used with dw_window_from_id() or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3082 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3083 HWND dw_bitmap_new(unsigned long id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3084 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3085 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3086 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3087 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3088 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3089 tmp = gtk_image_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3090 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3091 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3092 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3093 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3094 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3095 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3096 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3097 * Create a notebook object to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3098 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3099 * id: An ID to be used for getting the resource from the |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3100 * resource file. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3101 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3102 HWND dw_notebook_new(unsigned long id, int top) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3103 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3104 GtkWidget *tmp, **pagearray = calloc(sizeof(GtkWidget *), 256); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3105 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3106 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3107 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3108 tmp = gtk_notebook_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3109 if(top) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3110 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(tmp), GTK_POS_TOP); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3111 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3112 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(tmp), GTK_POS_BOTTOM); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3113 gtk_notebook_set_scrollable(GTK_NOTEBOOK(tmp), TRUE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3114 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3115 gtk_notebook_popup_enable(GTK_NOTEBOOK(tmp)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3116 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3117 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3118 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3119 g_object_set_data(G_OBJECT(tmp), "_dw_pagearray", (gpointer)pagearray); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3120 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3121 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3122 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3123 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3124 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3125 * Create a menu object to be popped up. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3126 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3127 * id: An ID to be used for getting the resource from the |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3128 * resource file. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3129 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3130 HMENUI dw_menu_new(unsigned long id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3131 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3132 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3133 GtkAccelGroup *accel_group; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3134 HMENUI tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3135 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3136 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3137 tmp = gtk_menu_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3138 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3139 accel_group = gtk_accel_group_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3140 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3141 g_object_set_data(G_OBJECT(tmp), "_dw_accel", (gpointer)accel_group); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3142 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3143 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3144 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3145 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3146 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3147 * Create a menubar on a window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3148 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3149 * location: Handle of a window frame to be attached to. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3150 * If there is no box already packed into the "location", the menu will not appear |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3151 * so tell the user. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3152 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3153 HMENUI dw_menubar_new(HWND location) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3154 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3155 GtkWidget *box; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3156 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3157 GtkAccelGroup *accel_group; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3158 HMENUI tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3159 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3160 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3161 tmp = gtk_menu_bar_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3162 box = (GtkWidget *)g_object_get_data(G_OBJECT(location), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3163 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3164 accel_group = gtk_accel_group_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3165 g_object_set_data(G_OBJECT(tmp), "_dw_accel", (gpointer)accel_group); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3166 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3167 if (box) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3168 gtk_box_pack_end(GTK_BOX(box), tmp, FALSE, FALSE, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3169 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3170 fprintf(stderr,"dw_menubar_new(): Coding error: You MUST pack a box into the window in which this menubar is to be added BEFORE calling this function.\n"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3171 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3172 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3173 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3174 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3175 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3176 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3177 * Destroys a menu created with dw_menubar_new or dw_menu_new. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3178 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3179 * menu: Handle of a menu. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3180 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3181 void dw_menu_destroy(HMENUI *menu) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3182 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3183 if(menu && *menu) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3184 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3185 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3186 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3187 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3188 gtk_widget_destroy(*menu); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3189 *menu = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3190 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3191 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3192 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3193 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3194 char _removetilde(char *dest, char *src) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3195 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3196 int z, cur=0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3197 char accel = '\0'; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3198 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3199 for(z=0;z<strlen(src);z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3200 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3201 if(src[z] != '~') |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3202 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3203 dest[cur] = src[z]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3204 cur++; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3205 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3206 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3207 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3208 dest[cur] = '_'; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3209 accel = src[z+1]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3210 cur++; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3211 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3212 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3213 dest[cur] = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3214 return accel; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3215 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3216 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3217 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3218 * Adds a menuitem or submenu to an existing menu. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3219 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3220 * menu: The handle to the existing menu. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3221 * title: The title text on the menu item to be added. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3222 * id: An ID to be used for message passing. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3223 * flags: Extended attributes to set on the menu. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3224 * end: If TRUE memu is positioned at the end of the menu. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3225 * check: If TRUE menu is "check"able. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3226 * submenu: Handle to an existing menu to be a submenu or NULL. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3227 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3228 HWND dw_menu_append_item(HMENUI menu, char *title, unsigned long id, unsigned long flags, int end, int check, HMENUI submenu) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3229 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3230 GtkWidget *tmphandle; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3231 char accel, *tempbuf = malloc(strlen(title)+1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3232 int _locked_by_me = FALSE, submenucount; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3233 guint tmp_key; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3234 GtkAccelGroup *accel_group; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3235 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3236 if (!menu) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3237 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3238 free(tempbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3239 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3240 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3241 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3242 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3243 accel = _removetilde(tempbuf, title); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3244 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3245 accel_group = (GtkAccelGroup *)g_object_get_data(G_OBJECT(menu), "_dw_accel"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3246 submenucount = (int)g_object_get_data(G_OBJECT(menu), "_dw_submenucount"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3247 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3248 if (strlen(tempbuf) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3249 tmphandle=gtk_menu_item_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3250 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3251 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3252 if (check) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3253 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3254 char numbuf[10]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3255 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3256 tmphandle = gtk_check_menu_item_new_with_label(tempbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3257 if (accel && accel_group) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3258 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3259 gtk_label_set_use_underline(GTK_LABEL(gtk_bin_get_child(GTK_BIN(tmphandle))), TRUE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3260 #if 0 /* TODO: This isn't working right */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3261 gtk_widget_add_accelerator(tmphandle, "activate", accel_group, tmp_key, GDK_MOD1_MASK, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3262 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3263 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3264 sprintf(numbuf, "%lu", id); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3265 g_object_set_data(G_OBJECT(menu), numbuf, (gpointer)tmphandle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3266 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3267 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3268 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3269 char numbuf[10]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3270 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3271 tmphandle=gtk_menu_item_new_with_label(tempbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3272 if (accel && accel_group) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3273 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3274 gtk_label_set_use_underline(GTK_LABEL(gtk_bin_get_child(GTK_BIN(tmphandle))), TRUE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3275 #if 0 /* TODO: This isn't working right */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3276 gtk_widget_add_accelerator(tmphandle, "activate", accel_group, tmp_key, GDK_MOD1_MASK, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3277 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3278 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3279 sprintf(numbuf, "%lu", id); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3280 g_object_set_data(G_OBJECT(menu), numbuf, (gpointer)tmphandle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3281 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3282 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3283 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3284 gtk_widget_show(tmphandle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3285 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3286 if (submenu) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3287 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3288 char tempbuf[100]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3289 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3290 sprintf(tempbuf, "_dw_submenu%d", submenucount); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3291 submenucount++; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3292 gtk_menu_item_set_submenu(GTK_MENU_ITEM(tmphandle), submenu); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3293 g_object_set_data(G_OBJECT(menu), tempbuf, (gpointer)submenu); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3294 g_object_set_data(G_OBJECT(menu), "_dw_submenucount", (gpointer)submenucount); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3295 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3296 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3297 if (GTK_IS_MENU_BAR(menu)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3298 gtk_menu_shell_append(GTK_MENU_SHELL(menu), tmphandle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3299 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3300 gtk_menu_shell_append(GTK_MENU_SHELL(menu), tmphandle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3301 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3302 g_object_set_data(G_OBJECT(tmphandle), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3303 free(tempbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3304 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3305 * Set flags |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3306 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3307 if ( check && (flags & DW_MIS_CHECKED) ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3308 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3309 _dw_ignore_click = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3310 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(tmphandle), 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3311 _dw_ignore_click = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3312 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3313 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3314 if ( flags & DW_MIS_DISABLED ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3315 gtk_widget_set_sensitive( tmphandle, FALSE ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3316 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3317 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3318 return tmphandle; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3319 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3320 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3321 GtkWidget *_find_submenu_id(GtkWidget *start, char *name) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3322 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3323 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3324 int z, submenucount = (int)g_object_get_data(G_OBJECT(start), "_dw_submenucount"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3325 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3326 if((tmp = g_object_get_data(G_OBJECT(start), name))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3327 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3328 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3329 for(z=0;z<submenucount;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3330 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3331 char tempbuf[100]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3332 GtkWidget *submenu, *menuitem; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3333 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3334 sprintf(tempbuf, "_dw_submenu%d", z); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3335 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3336 if((submenu = g_object_get_data(G_OBJECT(start), tempbuf))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3337 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3338 if((menuitem = _find_submenu_id(submenu, name))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3339 return menuitem; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3340 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3341 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3342 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3343 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3344 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3345 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3346 * Sets the state of a menu item check. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3347 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3348 * menu: The handle the the existing menu. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3349 * id: Menuitem id. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3350 * check: TRUE for checked FALSE for not checked. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3351 * deprecated: use dw_menu_item_set_state() |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3352 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3353 void dw_menu_item_set_check(HMENUI menu, unsigned long id, int check) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3354 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3355 char numbuf[10]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3356 GtkWidget *tmphandle; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3357 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3358 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3359 if(!menu) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3360 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3361 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3362 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3363 sprintf(numbuf, "%lu", id); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3364 tmphandle = _find_submenu_id(menu, numbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3365 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3366 if(tmphandle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3367 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3368 _dw_ignore_click = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3369 if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(tmphandle)) != check) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3370 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(tmphandle), check); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3371 _dw_ignore_click = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3372 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3373 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3374 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3375 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3376 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3377 * Sets the state of a menu item. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3378 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3379 * menu: The handle the the existing menu. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3380 * id: Menuitem id. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3381 * state: TRUE for checked FALSE for not checked. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3382 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3383 void dw_menu_item_set_state(HMENUI menu, unsigned long id, unsigned long state) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3384 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3385 char numbuf[10]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3386 GtkWidget *tmphandle; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3387 int check; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3388 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3389 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3390 if(!menu) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3391 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3392 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3393 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3394 sprintf(numbuf, "%lu", id); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3395 tmphandle = _find_submenu_id(menu, numbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3396 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3397 if ( (state & DW_MIS_CHECKED) || (state & DW_MIS_UNCHECKED) ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3398 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3399 if ( state & DW_MIS_CHECKED ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3400 check = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3401 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3402 check = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3403 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3404 if (tmphandle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3405 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3406 _dw_ignore_click = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3407 if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(tmphandle)) != check) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3408 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(tmphandle), check); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3409 _dw_ignore_click = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3410 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3411 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3412 if ( (state & DW_MIS_ENABLED) || (state & DW_MIS_DISABLED) ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3413 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3414 if (tmphandle ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3415 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3416 _dw_ignore_click = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3417 if ( state & DW_MIS_ENABLED ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3418 gtk_widget_set_sensitive( tmphandle, TRUE ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3419 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3420 gtk_widget_set_sensitive( tmphandle, FALSE ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3421 _dw_ignore_click = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3422 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3423 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3424 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3425 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3426 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3427 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3428 * Pops up a context menu at given x and y coordinates. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3429 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3430 * menu: The handle the the existing menu. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3431 * parent: Handle to the window initiating the popup. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3432 * x: X coordinate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3433 * y: Y coordinate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3434 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3435 void dw_menu_popup(HMENUI *menu, HWND parent, int x, int y) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3436 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3437 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3438 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3439 if(!menu || !*menu) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3440 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3441 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3442 popup = parent; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3443 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3444 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3445 gtk_menu_popup(GTK_MENU(*menu), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3446 *menu = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3447 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3448 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3449 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3450 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3451 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3452 * Returns the current X and Y coordinates of the mouse pointer. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3453 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3454 * x: Pointer to variable to store X coordinate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3455 * y: Pointer to variable to store Y coordinate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3456 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3457 void dw_pointer_query_pos(long *x, long *y) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3458 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3459 GdkModifierType state; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3460 int gx, gy; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3461 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3462 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3463 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3464 #ifdef GDK_WINDOWING_X11 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3465 gdk_window_get_pointer (gdk_x11_window_lookup_for_display(gdk_display_get_default(), GDK_ROOT_WINDOW()), &gx, &gy, &state); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3466 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3467 *x = gx; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3468 *y = gy; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3469 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3470 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3471 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3472 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3473 * Sets the X and Y coordinates of the mouse pointer. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3474 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3475 * x: X coordinate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3476 * y: Y coordinate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3477 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3478 void dw_pointer_set_pos(long x, long y) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3479 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3480 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3481 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3482 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3483 #ifdef GDK_WINDOWING_X11 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3484 # if GTK_CHECK_VERSION(2,8,0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3485 gdk_display_warp_pointer( gdk_display_get_default(), gdk_screen_get_default(), x, y ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3486 // gdk_display_warp_pointer( GDK_DISPLAY(), gdk_screen_get_default(), x, y ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3487 # else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3488 XWarpPointer(GDK_DISPLAY(), None, GDK_ROOT_WINDOW(), 0,0,0,0, x, y); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3489 # endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3490 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3491 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3492 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3493 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3494 #define _DW_TREE_CONTAINER 1 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3495 #define _DW_TREE_TREE 2 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3496 #define _DW_TREE_LISTBOX 3 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3497 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3498 GtkWidget *_tree_create(unsigned long id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3499 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3500 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3501 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3502 tmp = gtk_scrolled_window_new(NULL, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3503 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (tmp), |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3504 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3505 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3506 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3507 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3508 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3509 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3510 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3511 GtkWidget *_tree_setup(GtkWidget *tmp, GtkTreeModel *store) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3512 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3513 GtkWidget *tree = gtk_tree_view_new_with_model(store); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3514 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(tmp), tree); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3515 g_object_set_data(G_OBJECT(tmp), "_dw_user", (gpointer)tree); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3516 return tree; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3517 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3518 |
777
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
3519 #define _DW_TREE_TYPE_CONTAINER 1 |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
3520 #define _DW_TREE_TYPE_TREE 2 |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
3521 #define _DW_TREE_TYPE_LISTBOX 3 |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
3522 #define _DW_TREE_TYPE_COMBOBOX 4 |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
3523 |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3524 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3525 * Create a container object to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3526 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3527 * id: An ID to be used for getting the resource from the |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3528 * resource file. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3529 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3530 HWND dw_container_new(unsigned long id, int multi) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3531 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3532 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3533 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3534 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3535 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3536 if(!(tmp = _tree_create(id))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3537 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3538 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3539 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3540 } |
777
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
3541 g_object_set_data(G_OBJECT(tmp), "_dw_tree_type", (gpointer)_DW_TREE_TYPE_CONTAINER); |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3542 g_object_set_data(G_OBJECT(tmp), "_dw_multi_sel", GINT_TO_POINTER(multi)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3543 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3544 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3545 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3546 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3547 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3548 * Create a tree object to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3549 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3550 * id: An ID to be used for getting the resource from the |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3551 * resource file. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3552 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3553 HWND dw_tree_new(ULONG id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3554 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3555 GtkWidget *tmp, *tree; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3556 GtkTreeStore *store; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3557 GtkTreeViewColumn *col; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3558 GtkCellRenderer *rend; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3559 GtkTreeSelection *sel; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3560 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3561 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3562 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3563 if(!(tmp = _tree_create(id))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3564 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3565 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3566 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3567 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3568 store = gtk_tree_store_new(4, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_POINTER, G_TYPE_POINTER); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3569 tree = _tree_setup(tmp, GTK_TREE_MODEL(store)); |
777
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
3570 g_object_set_data(G_OBJECT(tmp), "_dw_tree_type", (gpointer)_DW_TREE_TYPE_TREE); |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3571 col = gtk_tree_view_column_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3572 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3573 rend = gtk_cell_renderer_pixbuf_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3574 gtk_tree_view_column_pack_start(col, rend, FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3575 gtk_tree_view_column_add_attribute(col, rend, "pixbuf", 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3576 rend = gtk_cell_renderer_text_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3577 gtk_tree_view_column_pack_start(col, rend, TRUE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3578 gtk_tree_view_column_add_attribute(col, rend, "text", 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3579 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3580 gtk_tree_view_append_column(GTK_TREE_VIEW (tree), col); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3581 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(tree), col); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3582 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3583 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3584 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3585 gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3586 gtk_widget_show(tree); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3587 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3588 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3589 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3590 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3591 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3592 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3593 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3594 * Create a new static text window (widget) to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3595 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3596 * text: The text to be display by the static text widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3597 * id: An ID to be used with dw_window_from_id() or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3598 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3599 HWND dw_text_new(char *text, unsigned long id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3600 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3601 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3602 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3603 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3604 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3605 tmp = gtk_label_new(text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3606 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3607 /* Left and centered */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3608 gtk_misc_set_alignment(GTK_MISC(tmp), 0.0f, 0.5f); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3609 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3610 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3611 gtk_misc_set_alignment(GTK_MISC(tmp), DW_LEFT, DW_LEFT); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3612 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3613 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3614 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3615 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3616 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3617 * Create a new status text window (widget) to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3618 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3619 * text: The text to be display by the static text widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3620 * id: An ID to be used with dw_window_from_id() or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3621 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3622 HWND dw_status_text_new(char *text, ULONG id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3623 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3624 GtkWidget *tmp, *frame; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3625 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3626 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3627 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3628 frame = gtk_frame_new(NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3629 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3630 tmp = gtk_label_new(text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3631 gtk_container_add(GTK_CONTAINER(frame), tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3632 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3633 gtk_widget_show(frame); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3634 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3635 /* Left and centered */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3636 gtk_misc_set_alignment(GTK_MISC(tmp), 0.0f, 0.5f); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3637 g_object_set_data(G_OBJECT(frame), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3638 g_object_set_data(G_OBJECT(frame), "_dw_label", (gpointer)tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3639 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3640 return frame; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3641 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3642 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3643 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3644 * Create a new Multiline Editbox window (widget) to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3645 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3646 * id: An ID to be used with dw_window_from_id() or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3647 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3648 HWND dw_mle_new(unsigned long id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3649 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3650 GtkWidget *tmp, *tmpbox, *scroller; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3651 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3652 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3653 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3654 tmpbox = gtk_scrolled_window_new (NULL, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3655 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(tmpbox), |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3656 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3657 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(tmpbox), GTK_SHADOW_ETCHED_IN); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3658 tmp = gtk_text_view_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3659 gtk_container_add (GTK_CONTAINER(tmpbox), tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3660 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(tmp), GTK_WRAP_NONE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3661 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3662 scroller = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3663 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3664 g_object_set_data(G_OBJECT(tmpbox), "_dw_user", (gpointer)tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3665 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3666 gtk_widget_show(tmpbox); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3667 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3668 return tmpbox; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3669 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3670 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3671 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3672 * Create a new Entryfield window (widget) to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3673 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3674 * text: The default text to be in the entryfield widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3675 * id: An ID to be used with dw_window_from_id() or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3676 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3677 HWND dw_entryfield_new(char *text, unsigned long id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3678 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3679 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3680 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3681 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3682 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3683 tmp = gtk_entry_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3684 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3685 gtk_entry_set_text(GTK_ENTRY(tmp), text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3686 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3687 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3688 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3689 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3690 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3691 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3692 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3693 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3694 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3695 * Create a new Entryfield (password) window (widget) to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3696 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3697 * text: The default text to be in the entryfield widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3698 * id: An ID to be used with dw_window_from_id() or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3699 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3700 HWND dw_entryfield_password_new(char *text, ULONG id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3701 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3702 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3703 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3704 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3705 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3706 tmp = gtk_entry_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3707 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3708 gtk_entry_set_visibility(GTK_ENTRY(tmp), FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3709 gtk_entry_set_text(GTK_ENTRY(tmp), text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3710 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3711 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3712 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3713 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3714 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3715 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3716 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3717 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3718 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3719 * Create a new Combobox window (widget) to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3720 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3721 * text: The default text to be in the combpbox widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3722 * id: An ID to be used with dw_window_from_id() or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3723 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3724 HWND dw_combobox_new(char *text, unsigned long id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3725 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3726 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3727 GtkListStore *store; |
777
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
3728 GtkCellRenderer *renderer; |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3729 int sigid, _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3730 gint cid; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3731 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3732 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3733 store = gtk_list_store_new(1, G_TYPE_STRING); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3734 tmp = gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(store)); |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
3735 gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(tmp), 0); |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3736 gtk_widget_show(tmp); |
777
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
3737 g_object_set_data(G_OBJECT(tmp), "_dw_tree_type", (gpointer)_DW_TREE_TYPE_COMBOBOX); |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3738 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3739 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3740 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3741 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3742 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3743 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3744 * Create a new button window (widget) to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3745 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3746 * text: The text to be display by the static text widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3747 * id: An ID to be used with dw_window_from_id() or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3748 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3749 HWND dw_button_new(char *text, unsigned long id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3750 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3751 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3752 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3753 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3754 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3755 tmp = gtk_button_new_with_label(text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3756 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3757 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3758 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3759 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3760 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3761 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3762 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3763 * Create a new bitmap button window (widget) to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3764 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3765 * text: Bubble help text to be displayed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3766 * id: An ID of a bitmap in the resource file. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3767 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3768 HWND dw_bitmapbutton_new(char *text, unsigned long id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3769 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3770 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3771 GtkWidget *bitmap; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3772 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3773 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3774 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3775 tmp = gtk_button_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3776 bitmap = dw_bitmap_new(id); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3777 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3778 if(bitmap) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3779 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3780 dw_window_set_bitmap(bitmap, id, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3781 gtk_container_add (GTK_CONTAINER(tmp), bitmap); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3782 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3783 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3784 if(text) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3785 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3786 gtk_widget_set_tooltip_text(tmp, text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3787 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3788 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3789 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3790 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3791 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3792 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3793 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3794 * Create a new bitmap button window (widget) to be packed from a file. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3795 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3796 * label_text: Text to display on button. TBD when Windows works |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3797 * text: Bubble help text to be displayed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3798 * id: An ID to be used with dw_window_from_id() or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3799 * filename: Name of the file, omit extention to have |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3800 * DW pick the appropriate file extension. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3801 * (BMP on OS/2 or Windows, XPM on Unix) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3802 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3803 HWND dw_bitmapbutton_new_from_file(char *text, unsigned long id, char *filename) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3804 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3805 GtkWidget *bitmap; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3806 GtkWidget *box; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3807 GtkWidget *label; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3808 GtkWidget *button; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3809 char *label_text=NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3810 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3811 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3812 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3813 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3814 /* Create box for image and label */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3815 box = gtk_hbox_new (FALSE, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3816 gtk_container_set_border_width (GTK_CONTAINER (box), 2); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3817 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3818 /* Now on to the image stuff */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3819 bitmap = dw_bitmap_new(id); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3820 if(bitmap) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3821 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3822 dw_window_set_bitmap( bitmap, 0, filename ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3823 /* Pack the image into the box */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3824 gtk_box_pack_start( GTK_BOX(box), bitmap, TRUE, FALSE, 3 ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3825 gtk_widget_show( bitmap ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3826 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3827 if(label_text) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3828 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3829 /* Create a label for the button */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3830 label = gtk_label_new( label_text ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3831 /* Pack the label into the box */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3832 gtk_box_pack_start( GTK_BOX(box), label, TRUE, FALSE, 3 ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3833 gtk_widget_show( label ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3834 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3835 /* Create a new button */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3836 button = gtk_button_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3837 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3838 /* Pack and show all our widgets */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3839 gtk_widget_show( box ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3840 gtk_container_add( GTK_CONTAINER(button), box ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3841 gtk_widget_show( button ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3842 if(text) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3843 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3844 gtk_widget_set_tooltip_text(button, text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3845 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3846 g_object_set_data(G_OBJECT(button), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3847 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3848 return button; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3849 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3850 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3851 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3852 * Create a new bitmap button window (widget) to be packed from data. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3853 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3854 * text: Bubble help text to be displayed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3855 * id: An ID to be used with dw_window_from_id() or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3856 * data: Raw data of image. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3857 * (BMP on OS/2 or Windows, XPM on Unix) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3858 * len: Length of raw data |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3859 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3860 HWND dw_bitmapbutton_new_from_data(char *text, unsigned long id, char *data, int len) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3861 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3862 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3863 GtkWidget *bitmap; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3864 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3865 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3866 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3867 tmp = gtk_button_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3868 bitmap = dw_bitmap_new(id); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3869 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3870 if ( bitmap ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3871 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3872 dw_window_set_bitmap_from_data(bitmap, 0, data, len); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3873 gtk_container_add (GTK_CONTAINER(tmp), bitmap); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3874 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3875 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3876 if(text) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3877 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3878 gtk_widget_set_tooltip_text(tmp, text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3879 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3880 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3881 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3882 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3883 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3884 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3885 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3886 * Create a new spinbutton window (widget) to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3887 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3888 * text: The text to be display by the static text widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3889 * id: An ID to be used with dw_window_from_id() or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3890 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3891 HWND dw_spinbutton_new(char *text, unsigned long id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3892 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3893 GtkAdjustment *adj; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3894 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3895 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3896 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3897 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3898 adj = (GtkAdjustment *)gtk_adjustment_new (1.0, 0.0, 100.0, 1.0, 5.0, 0.0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3899 tmp = gtk_spin_button_new (adj, 0, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3900 gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(tmp), TRUE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3901 gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(tmp), TRUE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3902 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3903 g_object_set_data(G_OBJECT(tmp), "_dw_adjustment", (gpointer)adj); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3904 g_object_set_data(G_OBJECT(adj), "_dw_spinbutton", (gpointer)tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3905 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3906 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3907 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3908 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3909 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3910 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3911 * Create a new radiobutton window (widget) to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3912 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3913 * text: The text to be display by the static text widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3914 * id: An ID to be used with dw_window_from_id() or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3915 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3916 HWND dw_radiobutton_new(char *text, ULONG id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3917 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3918 /* This will have to be fixed in the future. */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3919 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3920 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3921 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3922 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3923 tmp = gtk_radio_button_new_with_label(NULL, text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3924 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3925 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3926 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3927 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3928 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3929 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3930 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3931 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3932 * Create a new slider window (widget) to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3933 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3934 * vertical: TRUE or FALSE if slider is vertical. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3935 * increments: Number of increments available. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3936 * id: An ID to be used with dw_window_from_id() or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3937 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3938 HWND dw_slider_new(int vertical, int increments, ULONG id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3939 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3940 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3941 GtkAdjustment *adjustment; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3942 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3943 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3944 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3945 adjustment = (GtkAdjustment *)gtk_adjustment_new(0, 0, (gfloat)increments, 1, 1, 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3946 if(vertical) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3947 tmp = gtk_vscale_new(adjustment); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3948 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3949 tmp = gtk_hscale_new(adjustment); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3950 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3951 gtk_scale_set_draw_value(GTK_SCALE(tmp), 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3952 gtk_scale_set_digits(GTK_SCALE(tmp), 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3953 g_object_set_data(G_OBJECT(tmp), "_dw_adjustment", (gpointer)adjustment); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3954 g_object_set_data(G_OBJECT(adjustment), "_dw_slider", (gpointer)tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3955 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3956 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3957 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3958 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3959 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3960 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3961 * Create a new scrollbar window (widget) to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3962 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3963 * vertical: TRUE or FALSE if scrollbar is vertical. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3964 * increments: Number of increments available. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3965 * id: An ID to be used with dw_window_from_id() or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3966 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3967 HWND dw_scrollbar_new(int vertical, ULONG id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3968 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3969 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3970 GtkAdjustment *adjustment; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3971 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3972 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3973 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3974 adjustment = (GtkAdjustment *)gtk_adjustment_new(0, 0, 0, 1, 1, 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3975 if(vertical) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3976 tmp = gtk_vscrollbar_new(adjustment); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3977 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3978 tmp = gtk_hscrollbar_new(adjustment); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3979 gtk_widget_set_can_focus(tmp, FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3980 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3981 g_object_set_data(G_OBJECT(tmp), "_dw_adjustment", (gpointer)adjustment); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3982 g_object_set_data(G_OBJECT(adjustment), "_dw_scrollbar", (gpointer)tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3983 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3984 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3985 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3986 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3987 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3988 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3989 * Create a new percent bar window (widget) to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3990 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3991 * id: An ID to be used with dw_window_from_id() or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3992 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3993 HWND dw_percent_new(unsigned long id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3994 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3995 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3996 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3997 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3998 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3999 tmp = gtk_progress_bar_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4000 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4001 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4002 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4003 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4004 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4005 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4006 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4007 * Create a new checkbox window (widget) to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4008 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4009 * text: The text to be display by the static text widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4010 * id: An ID to be used with dw_window_from_id() or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4011 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4012 HWND dw_checkbox_new(char *text, unsigned long id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4013 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4014 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4015 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4016 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4017 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4018 tmp = gtk_check_button_new_with_label(text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4019 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4020 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4021 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4022 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4023 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4024 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4025 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4026 * Create a new listbox window (widget) to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4027 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4028 * id: An ID to be used with dw_window_from_id() or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4029 * multi: Multiple select TRUE or FALSE. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4030 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4031 HWND dw_listbox_new(unsigned long id, int multi) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4032 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4033 GtkWidget *tmp, *tree; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4034 GtkListStore *store; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4035 GtkTreeViewColumn *col; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4036 GtkCellRenderer *rend; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4037 GtkTreeSelection *sel; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4038 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4039 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4040 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4041 if(!(tmp = _tree_create(id))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4042 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4043 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4044 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4045 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4046 store = gtk_list_store_new(1, G_TYPE_STRING); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4047 tree = _tree_setup(tmp, GTK_TREE_MODEL(store)); |
777
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
4048 g_object_set_data(G_OBJECT(tmp), "_dw_tree_type", (gpointer)_DW_TREE_TYPE_LISTBOX); |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4049 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4050 col = gtk_tree_view_column_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4051 rend = gtk_cell_renderer_text_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4052 gtk_tree_view_column_pack_start(col, rend, TRUE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4053 gtk_tree_view_column_add_attribute(col, rend, "text", 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4054 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4055 gtk_tree_view_append_column(GTK_TREE_VIEW (tree), col); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4056 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(tree), col); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4057 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4058 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4059 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4060 if(multi) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4061 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4062 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4063 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4064 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4065 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4066 gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4067 } |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
4068 gtk_widget_show(tree); |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4069 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4070 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4071 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4072 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4073 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4074 * Sets the icon used for a given window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4075 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4076 * handle: Handle to the window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4077 * id: An ID to be used to specify the icon. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4078 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4079 void dw_window_set_icon(HWND handle, HICN icon) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4080 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4081 GdkPixbuf *icon_pixbuf; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4082 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4083 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4084 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4085 icon_pixbuf = _find_pixbuf(icon, NULL, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4086 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4087 if(gtk_widget_get_window(handle) && icon_pixbuf) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4088 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4089 GList *list = g_list_alloc(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4090 list = g_list_append(list, icon_pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4091 gdk_window_set_icon_list(gtk_widget_get_window(handle), list); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4092 g_object_unref(G_OBJECT(list)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4093 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4094 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4095 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4096 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4097 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4098 * Sets the bitmap used for a given static window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4099 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4100 * handle: Handle to the window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4101 * id: An ID to be used to specify the icon, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4102 * (pass 0 if you use the filename param) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4103 * filename: a path to a file (Bitmap on OS/2 or |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4104 * Windows and a pixmap on Unix, pass |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4105 * NULL if you use the id param) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4106 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4107 void dw_window_set_bitmap(HWND handle, unsigned long id, char *filename) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4108 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4109 GdkPixbuf *tmp = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4110 int found_ext = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4111 int i; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4112 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4113 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4114 if(!id && !filename) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4115 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4116 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4117 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4118 if(id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4119 tmp = _find_pixbuf(id, NULL, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4120 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4121 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4122 char *file = alloca(strlen(filename) + 5); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4123 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4124 if (!file) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4125 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4126 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4127 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4128 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4129 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4130 strcpy(file, filename); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4131 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4132 /* check if we can read from this file (it exists and read permission) */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4133 if ( access(file, 04 ) != 0 ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4134 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4135 /* Try with various extentions */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4136 for ( i = 0; i < NUM_EXTS; i++ ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4137 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4138 strcpy( file, filename ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4139 strcat( file, image_exts[i] ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4140 if ( access( file, 04 ) == 0 ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4141 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4142 found_ext = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4143 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4144 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4145 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4146 if ( found_ext == 0 ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4147 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4148 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4149 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4150 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4151 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4152 tmp = gdk_pixbuf_new_from_file(file, NULL ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4153 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4154 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4155 if (tmp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4156 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4157 if ( GTK_IS_BUTTON(handle) ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4158 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4159 GtkWidget *image = gtk_button_get_image( GTK_BUTTON(handle) ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4160 gtk_image_set_from_pixbuf(GTK_IMAGE(image), tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4161 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4162 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4163 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4164 gtk_image_set_from_pixbuf(GTK_IMAGE(handle), tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4165 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4166 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4167 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4168 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4169 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4170 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4171 * Sets the bitmap used for a given static window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4172 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4173 * handle: Handle to the window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4174 * id: An ID to be used to specify the icon, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4175 * (pass 0 if you use the filename param) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4176 * data: the image data |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4177 * Bitmap on Windows and a pixmap on Unix, pass |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4178 * NULL if you use the id param) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4179 * len: length of data |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4180 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4181 void dw_window_set_bitmap_from_data(HWND handle, unsigned long id, char *data, int len) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4182 { |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
4183 GdkPixbuf *tmp = NULL; |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4184 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4185 char *file; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4186 FILE *fp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4187 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4188 if (!id && !data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4189 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4190 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4191 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4192 if (id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4193 tmp = _find_pixbuf(id, NULL, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4194 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4195 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4196 GdkPixbuf *pixbuf; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4197 if (!data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4198 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4199 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4200 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4201 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4202 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4203 * A real hack; create a temporary file and write the contents |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4204 * of the data to the file |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4205 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4206 file = tmpnam( NULL ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4207 fp = fopen( file, "wb" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4208 if ( fp ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4209 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4210 fwrite( data, len, 1, fp ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4211 fclose( fp ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4212 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4213 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4214 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4215 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4216 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4217 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4218 pixbuf = gdk_pixbuf_new_from_file(file, NULL ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4219 /* remove our temporary file */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4220 unlink (file ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4221 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4222 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4223 if(tmp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4224 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4225 gtk_image_set_from_pixbuf(GTK_IMAGE(handle), tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4226 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4227 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4228 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4229 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4230 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4231 * Sets the text used for a given window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4232 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4233 * handle: Handle to the window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4234 * text: The text associated with a given window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4235 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4236 void dw_window_set_text(HWND handle, char *text) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4237 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4238 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4239 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4240 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4241 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4242 if((tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_mdi_title"))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4243 handle = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4244 if(GTK_IS_ENTRY(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4245 gtk_entry_set_text(GTK_ENTRY(handle), text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4246 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4247 else if(GTK_IS_COMBO_BOX(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4248 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO_BOX(handle)->entry), text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4249 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4250 else if(GTK_IS_LABEL(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4251 gtk_label_set_text(GTK_LABEL(handle), text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4252 else if(GTK_IS_BUTTON(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4253 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4254 gtk_button_set_label(GTK_BUTTON(handle), text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4255 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4256 else if(gtk_widget_is_toplevel(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4257 gtk_window_set_title(GTK_WINDOW(handle), text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4258 else if (GTK_IS_FRAME(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4259 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4260 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4261 * This is a groupbox or status_text |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4262 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4263 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_label"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4264 if ( tmp && GTK_IS_LABEL(tmp) ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4265 gtk_label_set_text(GTK_LABEL(tmp), text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4266 else /* assume groupbox */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4267 gtk_frame_set_label(GTK_FRAME(handle), text && *text ? text : NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4268 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4269 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4270 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4271 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4272 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4273 * Gets the text used for a given window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4274 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4275 * handle: Handle to the window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4276 * Returns: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4277 * text: The text associsated with a given window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4278 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4279 char *dw_window_get_text(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4280 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4281 const char *possible = ""; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4282 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4283 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4284 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4285 if(GTK_IS_ENTRY(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4286 possible = gtk_entry_get_text(GTK_ENTRY(handle)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4287 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4288 else if(GTK_IS_COMBO_BOX(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4289 possible = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO_BOX(handle)->entry)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4290 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4291 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4292 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4293 return strdup(possible); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4294 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4295 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4296 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4297 * Disables given window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4298 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4299 * handle: Handle to the window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4300 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4301 void dw_window_disable(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4302 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4303 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4304 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4305 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4306 gtk_widget_set_sensitive(handle, FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4307 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4308 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4309 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4310 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4311 * Enables given window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4312 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4313 * handle: Handle to the window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4314 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4315 void dw_window_enable(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4316 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4317 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4318 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4319 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4320 gtk_widget_set_sensitive(handle, TRUE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4321 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4322 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4323 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4324 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4325 * Gets the child window handle with specified ID. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4326 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4327 * handle: Handle to the parent window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4328 * id: Integer ID of the child. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4329 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4330 HWND API dw_window_from_id(HWND handle, int id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4331 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4332 GList *orig = NULL, *list = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4333 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4334 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4335 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4336 if(handle && GTK_IS_CONTAINER(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4337 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4338 orig = list = gtk_container_get_children(GTK_CONTAINER(handle)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4339 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4340 while(list) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4341 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4342 if(GTK_IS_WIDGET(list->data)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4343 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4344 if(id == (int)g_object_get_data(G_OBJECT(list->data), "_dw_id")) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4345 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4346 HWND ret = (HWND)list->data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4347 g_list_free(orig); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4348 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4349 return ret; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4350 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4351 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4352 list = list->next; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4353 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4354 if(orig) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4355 g_list_free(orig); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4356 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4357 return 0L; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4358 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4359 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4360 void _strip_cr(char *dest, char *src) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4361 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4362 int z, x = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4363 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4364 for(z=0;z<strlen(src);z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4365 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4366 if(src[z] != '\r') |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4367 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4368 dest[x] = src[z]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4369 x++; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4370 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4371 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4372 dest[x] = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4373 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4374 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4375 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4376 * Adds text to an MLE box and returns the current point. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4377 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4378 * handle: Handle to the MLE to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4379 * buffer: Text buffer to be imported. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4380 * startpoint: Point to start entering text. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4381 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4382 unsigned int dw_mle_import(HWND handle, char *buffer, int startpoint) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4383 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4384 unsigned int tmppoint = startpoint; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4385 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4386 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4387 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4388 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4389 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4390 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4391 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4392 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4393 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4394 char *impbuf = malloc(strlen(buffer)+1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4395 GtkTextBuffer *tbuffer; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4396 GtkTextIter iter; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4397 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4398 _strip_cr(impbuf, buffer); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4399 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4400 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4401 gtk_text_buffer_get_iter_at_offset(tbuffer, &iter, startpoint); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4402 gtk_text_buffer_place_cursor(tbuffer, &iter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4403 gtk_text_buffer_insert_at_cursor(tbuffer, impbuf, -1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4404 tmppoint = (startpoint > -1 ? startpoint : 0) + strlen(impbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4405 free(impbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4406 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4407 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4408 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4409 return tmppoint; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4410 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4411 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4412 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4413 * Grabs text from an MLE box. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4414 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4415 * handle: Handle to the MLE to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4416 * buffer: Text buffer to be exported. MUST allow for trailing nul character. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4417 * startpoint: Point to start grabbing text. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4418 * length: Amount of text to be grabbed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4419 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4420 void dw_mle_export(HWND handle, char *buffer, int startpoint, int length) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4421 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4422 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4423 gchar *text; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4424 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4425 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4426 /* force the return value to nul in case the following tests fail */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4427 if(buffer) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4428 buffer[0] = '\0'; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4429 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4430 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4431 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4432 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4433 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4434 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4435 GtkTextBuffer *tbuffer; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4436 GtkTextIter start, end; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4437 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4438 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4439 gtk_text_buffer_get_iter_at_offset(tbuffer, &start, startpoint); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4440 gtk_text_buffer_get_iter_at_offset(tbuffer, &end, startpoint + length); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4441 text = gtk_text_iter_get_text(&start, &end); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4442 if(text) /* Should this get freed? */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4443 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4444 if(buffer) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4445 strcpy(buffer, text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4446 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4447 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4448 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4449 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4450 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4451 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4452 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4453 * Obtains information about an MLE box. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4454 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4455 * handle: Handle to the MLE to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4456 * bytes: A pointer to a variable to return the total bytes. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4457 * lines: A pointer to a variable to return the number of lines. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4458 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4459 void dw_mle_get_size(HWND handle, unsigned long *bytes, unsigned long *lines) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4460 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4461 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4462 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4463 if(bytes) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4464 *bytes = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4465 if(lines) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4466 *lines = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4467 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4468 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4469 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4470 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4471 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4472 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4473 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4474 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4475 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tmp)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4476 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4477 if(bytes) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4478 *bytes = gtk_text_buffer_get_char_count(buffer) + 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4479 if(lines) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4480 *lines = gtk_text_buffer_get_line_count(buffer) + 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4481 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4482 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4483 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4484 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4485 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4486 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4487 * Deletes text from an MLE box. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4488 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4489 * handle: Handle to the MLE to be deleted from. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4490 * startpoint: Point to start deleting text. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4491 * length: Amount of text to be deleted. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4492 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4493 void dw_mle_delete(HWND handle, int startpoint, int length) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4494 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4495 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4496 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4497 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4498 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4499 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4500 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4501 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4502 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4503 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4504 GtkTextBuffer *tbuffer; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4505 GtkTextIter start, end; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4506 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4507 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4508 gtk_text_buffer_get_iter_at_offset(tbuffer, &start, startpoint); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4509 gtk_text_buffer_get_iter_at_offset(tbuffer, &end, startpoint + length); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4510 gtk_text_buffer_delete(tbuffer, &start, &end); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4511 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4512 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4513 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4514 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4515 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4516 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4517 * Clears all text from an MLE box. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4518 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4519 * handle: Handle to the MLE to be cleared. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4520 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4521 void dw_mle_clear(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4522 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4523 int length, _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4524 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4525 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4526 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4527 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4528 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4529 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4530 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4531 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4532 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tmp)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4533 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4534 length = -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4535 gtk_text_buffer_set_text(buffer, "", length); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4536 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4537 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4538 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4539 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4540 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4541 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4542 * Sets the visible line of an MLE box. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4543 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4544 * handle: Handle to the MLE. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4545 * line: Line to be visible. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4546 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4547 void dw_mle_set_visible(HWND handle, int line) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4548 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4549 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4550 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4551 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4552 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4553 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4554 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4555 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4556 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4557 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4558 GtkTextBuffer *tbuffer; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4559 GtkTextIter iter; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4560 GtkTextMark *mark = (GtkTextMark *)g_object_get_data(G_OBJECT(handle), "_dw_mark"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4561 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4562 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4563 gtk_text_buffer_get_iter_at_offset(tbuffer, &iter, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4564 gtk_text_iter_set_line(&iter, line); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4565 if(!mark) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4566 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4567 mark = gtk_text_buffer_create_mark(tbuffer, NULL, &iter, FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4568 g_object_set_data(G_OBJECT(handle), "_dw_mark", (gpointer)mark); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4569 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4570 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4571 gtk_text_buffer_move_mark(tbuffer, mark, &iter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4572 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(tmp), mark, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4573 0, FALSE, 0, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4574 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4575 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4576 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4577 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4578 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4579 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4580 * Sets the editablity of an MLE box. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4581 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4582 * handle: Handle to the MLE. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4583 * state: TRUE if it can be edited, FALSE for readonly. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4584 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4585 void dw_mle_set_editable(HWND handle, int state) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4586 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4587 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4588 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4589 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4590 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4591 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4592 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4593 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4594 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4595 gtk_text_view_set_editable(GTK_TEXT_VIEW(tmp), state); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4596 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4597 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4598 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4599 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4600 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4601 * Sets the word wrap state of an MLE box. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4602 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4603 * handle: Handle to the MLE. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4604 * state: TRUE if it wraps, FALSE if it doesn't. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4605 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4606 void dw_mle_set_word_wrap(HWND handle, int state) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4607 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4608 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4609 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4610 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4611 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4612 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4613 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4614 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4615 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4616 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(tmp), GTK_WRAP_WORD); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4617 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4618 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4619 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4620 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4621 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4622 * Sets the current cursor position of an MLE box. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4623 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4624 * handle: Handle to the MLE to be positioned. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4625 * point: Point to position cursor. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4626 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4627 void dw_mle_set_cursor(HWND handle, int point) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4628 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4629 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4630 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4631 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4632 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4633 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4634 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4635 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4636 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4637 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4638 GtkTextBuffer *tbuffer; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4639 GtkTextIter iter; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4640 GtkTextMark *mark = (GtkTextMark *)g_object_get_data(G_OBJECT(handle), "_dw_mark"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4641 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4642 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4643 gtk_text_buffer_get_iter_at_offset(tbuffer, &iter, point); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4644 if(!mark) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4645 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4646 mark = gtk_text_buffer_create_mark(tbuffer, NULL, &iter, FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4647 g_object_set_data(G_OBJECT(handle), "_dw_mark", (gpointer)mark); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4648 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4649 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4650 gtk_text_buffer_move_mark(tbuffer, mark, &iter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4651 gtk_text_buffer_place_cursor(tbuffer, &iter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4652 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(tmp), mark, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4653 0, FALSE, 0, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4654 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4655 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4656 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4657 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4658 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4659 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4660 * Finds text in an MLE box. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4661 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4662 * handle: Handle to the MLE to be cleared. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4663 * text: Text to search for. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4664 * point: Start point of search. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4665 * flags: Search specific flags. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4666 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4667 int dw_mle_search(HWND handle, char *text, int point, unsigned long flags) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4668 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4669 int _locked_by_me = FALSE, retval = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4670 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4671 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4672 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4673 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4674 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4675 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4676 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4677 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4678 GtkTextBuffer *tbuffer; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4679 GtkTextIter iter, found; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4680 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4681 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4682 gtk_text_buffer_get_iter_at_offset(tbuffer, &iter, point); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4683 gtk_text_iter_forward_search(&iter, text, GTK_TEXT_SEARCH_TEXT_ONLY, &found, NULL, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4684 retval = gtk_text_iter_get_offset(&found); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4685 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4686 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4687 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4688 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4689 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4690 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4691 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4692 * Stops redrawing of an MLE box. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4693 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4694 * handle: Handle to the MLE to freeze. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4695 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4696 void dw_mle_freeze(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4697 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4698 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4699 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4700 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4701 * Resumes redrawing of an MLE box. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4702 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4703 * handle: Handle to the MLE to thaw. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4704 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4705 void dw_mle_thaw(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4706 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4707 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4708 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4709 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4710 * Sets the percent bar position. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4711 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4712 * handle: Handle to the percent bar to be set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4713 * position: Position of the percent bar withing the range. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4714 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4715 void dw_percent_set_pos(HWND handle, unsigned int position) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4716 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4717 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4718 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4719 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4720 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(handle), (gfloat)position/100); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4721 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4722 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4723 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4724 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4725 * Returns the position of the slider. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4726 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4727 * handle: Handle to the slider to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4728 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4729 unsigned int dw_slider_get_pos(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4730 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4731 int val = 0, _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4732 GtkAdjustment *adjustment; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4733 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4734 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4735 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4736 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4737 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4738 adjustment = (GtkAdjustment *)g_object_get_data(G_OBJECT(handle), "_dw_adjustment"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4739 if(adjustment) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4740 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4741 int max = _round_value(gtk_adjustment_get_upper(adjustment)) - 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4742 int thisval = _round_value(gtk_adjustment_get_value(adjustment)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4743 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4744 if(GTK_IS_VSCALE(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4745 val = max - thisval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4746 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4747 val = thisval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4748 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4749 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4750 return val; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4751 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4752 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4753 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4754 * Sets the slider position. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4755 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4756 * handle: Handle to the slider to be set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4757 * position: Position of the slider withing the range. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4758 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4759 void dw_slider_set_pos(HWND handle, unsigned int position) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4760 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4761 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4762 GtkAdjustment *adjustment; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4763 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4764 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4765 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4766 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4767 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4768 adjustment = (GtkAdjustment *)g_object_get_data(G_OBJECT(handle), "_dw_adjustment"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4769 if(adjustment) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4770 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4771 int max = _round_value(gtk_adjustment_get_upper(adjustment)) - 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4772 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4773 if(GTK_IS_VSCALE(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4774 gtk_adjustment_set_value(adjustment, (gfloat)(max - position)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4775 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4776 gtk_adjustment_set_value(adjustment, (gfloat)position); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4777 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4778 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4779 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4780 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4781 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4782 * Returns the position of the scrollbar. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4783 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4784 * handle: Handle to the scrollbar to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4785 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4786 unsigned int dw_scrollbar_get_pos(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4787 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4788 int val = 0, _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4789 GtkAdjustment *adjustment; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4790 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4791 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4792 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4793 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4794 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4795 adjustment = (GtkAdjustment *)g_object_get_data(G_OBJECT(handle), "_dw_adjustment"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4796 if(adjustment) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4797 val = _round_value(gtk_adjustment_get_value(adjustment)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4798 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4799 return val; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4800 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4801 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4802 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4803 * Sets the scrollbar position. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4804 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4805 * handle: Handle to the scrollbar to be set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4806 * position: Position of the scrollbar withing the range. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4807 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4808 void dw_scrollbar_set_pos(HWND handle, unsigned int position) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4809 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4810 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4811 GtkAdjustment *adjustment; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4812 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4813 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4814 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4815 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4816 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4817 adjustment = (GtkAdjustment *)g_object_get_data(G_OBJECT(handle), "_dw_adjustment"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4818 if(adjustment) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4819 gtk_adjustment_set_value(adjustment, (gfloat)position); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4820 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4821 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4822 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4823 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4824 * Sets the scrollbar range. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4825 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4826 * handle: Handle to the scrollbar to be set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4827 * range: Maximum range value. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4828 * visible: Visible area relative to the range. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4829 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4830 void API dw_scrollbar_set_range(HWND handle, unsigned int range, unsigned int visible) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4831 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4832 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4833 GtkAdjustment *adjustment; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4834 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4835 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4836 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4837 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4838 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4839 adjustment = (GtkAdjustment *)g_object_get_data(G_OBJECT(handle), "_dw_adjustment"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4840 if(adjustment) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4841 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4842 gtk_adjustment_set_upper(adjustment, (gdouble)range); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4843 gtk_adjustment_set_page_increment(adjustment,(gdouble)visible); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4844 gtk_adjustment_set_page_size(adjustment, (gdouble)visible); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4845 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4846 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4847 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4848 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4849 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4850 * Sets the spinbutton value. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4851 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4852 * handle: Handle to the spinbutton to be set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4853 * position: Current value of the spinbutton. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4854 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4855 void dw_spinbutton_set_pos(HWND handle, long position) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4856 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4857 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4858 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4859 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4860 gtk_spin_button_set_value(GTK_SPIN_BUTTON(handle), (gfloat)position); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4861 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4862 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4863 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4864 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4865 * Sets the spinbutton limits. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4866 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4867 * handle: Handle to the spinbutton to be set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4868 * position: Current value of the spinbutton. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4869 * position: Current value of the spinbutton. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4870 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4871 void dw_spinbutton_set_limits(HWND handle, long upper, long lower) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4872 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4873 long curval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4874 GtkAdjustment *adj; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4875 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4876 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4877 curval = dw_spinbutton_get_pos(handle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4878 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4879 adj = (GtkAdjustment *)gtk_adjustment_new((gfloat)curval, (gfloat)lower, (gfloat)upper, 1.0, 5.0, 0.0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4880 gtk_spin_button_set_adjustment(GTK_SPIN_BUTTON(handle), adj); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4881 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4882 * Set our internal relationships between the adjustment and the spinbutton |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4883 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4884 g_object_set_data(G_OBJECT(handle), "_dw_adjustment", (gpointer)adj); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4885 g_object_set_data(G_OBJECT(adj), "_dw_spinbutton", (gpointer)handle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4886 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4887 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4888 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4889 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4890 * Sets the entryfield character limit. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4891 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4892 * handle: Handle to the spinbutton to be set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4893 * limit: Number of characters the entryfield will take. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4894 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4895 void dw_entryfield_set_limit(HWND handle, ULONG limit) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4896 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4897 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4898 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4899 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4900 gtk_entry_set_max_length(GTK_ENTRY(handle), limit); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4901 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4902 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4903 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4904 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4905 * Returns the current value of the spinbutton. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4906 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4907 * handle: Handle to the spinbutton to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4908 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4909 long dw_spinbutton_get_pos(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4910 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4911 long retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4912 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4913 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4914 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4915 retval = (long)gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(handle)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4916 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4917 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4918 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4919 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4920 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4921 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4922 * Returns the state of the checkbox. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4923 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4924 * handle: Handle to the checkbox to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4925 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4926 int dw_checkbox_get(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4927 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4928 int retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4929 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4930 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4931 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4932 retval = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(handle)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4933 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4934 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4935 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4936 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4937 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4938 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4939 * Sets the state of the checkbox. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4940 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4941 * handle: Handle to the checkbox to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4942 * value: TRUE for checked, FALSE for unchecked. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4943 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4944 void dw_checkbox_set(HWND handle, int value) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4945 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4946 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4947 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4948 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4949 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(handle), value); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4950 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4951 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4952 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4953 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4954 * Inserts an item into a tree window (widget) after another item. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4955 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4956 * handle: Handle to the tree to be inserted. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4957 * item: Handle to the item to be positioned after. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4958 * title: The text title of the entry. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4959 * icon: Handle to coresponding icon. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4960 * parent: Parent handle or 0 if root. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4961 * itemdata: Item specific data. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4962 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4963 HTREEITEM dw_tree_insert_after(HWND handle, HTREEITEM item, char *title, HICN icon, HTREEITEM parent, void *itemdata) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4964 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4965 GtkWidget *tree; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4966 GtkTreeIter *iter; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4967 GtkTreeStore *store; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4968 GdkPixbuf *pixbuf; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4969 HTREEITEM retval = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4970 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4971 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4972 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4973 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4974 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4975 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4976 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4977 && GTK_IS_TREE_VIEW(tree) && |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4978 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4979 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4980 iter = (GtkTreeIter *)malloc(sizeof(GtkTreeIter)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4981 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4982 pixbuf = _find_pixbuf(icon, NULL, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4983 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4984 gtk_tree_store_insert_after(store, iter, (GtkTreeIter *)parent, (GtkTreeIter *)item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4985 gtk_tree_store_set (store, iter, 0, title, 1, pixbuf, 2, itemdata, 3, iter, -1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4986 if(pixbuf && !(icon & (1 << 31))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4987 g_object_unref(pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4988 retval = (HTREEITEM)iter; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4989 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4990 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4991 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4992 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4993 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4994 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4995 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4996 * Inserts an item into a tree window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4997 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4998 * handle: Handle to the tree to be inserted. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4999 * title: The text title of the entry. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5000 * icon: Handle to coresponding icon. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5001 * parent: Parent handle or 0 if root. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5002 * itemdata: Item specific data. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5003 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5004 HTREEITEM dw_tree_insert(HWND handle, char *title, HICN icon, HTREEITEM parent, void *itemdata) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5005 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5006 GtkWidget *tree; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5007 GtkTreeIter *iter; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5008 GtkTreeStore *store; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5009 GdkPixbuf *pixbuf; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5010 HTREEITEM retval = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5011 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5012 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5013 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5014 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5015 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5016 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5017 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5018 && GTK_IS_TREE_VIEW(tree) && |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5019 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5020 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5021 iter = (GtkTreeIter *)malloc(sizeof(GtkTreeIter)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5022 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5023 pixbuf = _find_pixbuf(icon, NULL, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5024 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5025 gtk_tree_store_append (store, iter, (GtkTreeIter *)parent); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5026 gtk_tree_store_set (store, iter, 0, title, 1, pixbuf, 2, itemdata, 3, iter, -1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5027 if(pixbuf && !(icon & (1 << 31))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5028 g_object_unref(pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5029 retval = (HTREEITEM)iter; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5030 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5031 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5032 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5033 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5034 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5035 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5036 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5037 * Sets the text and icon of an item in a tree window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5038 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5039 * handle: Handle to the tree containing the item. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5040 * item: Handle of the item to be modified. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5041 * title: The text title of the entry. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5042 * icon: Handle to coresponding icon. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5043 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5044 void dw_tree_item_change(HWND handle, HTREEITEM item, char *title, HICN icon) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5045 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5046 GtkWidget *tree; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5047 GtkTreeStore *store; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5048 GdkPixbuf *pixbuf; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5049 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5050 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5051 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5052 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5053 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5054 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5055 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5056 && GTK_IS_TREE_VIEW(tree) && |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5057 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5058 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5059 pixbuf = _find_pixbuf(icon, NULL, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5060 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5061 gtk_tree_store_set(store, (GtkTreeIter *)item, 0, title, 1, pixbuf, -1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5062 if(pixbuf && !(icon & (1 << 31))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5063 g_object_unref(pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5064 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5065 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5066 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5067 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5068 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5069 * Sets the item data of a tree item. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5070 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5071 * handle: Handle to the tree containing the item. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5072 * item: Handle of the item to be modified. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5073 * itemdata: User defined data to be associated with item. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5074 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5075 void dw_tree_item_set_data(HWND handle, HTREEITEM item, void *itemdata) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5076 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5077 GtkWidget *tree; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5078 GtkTreeStore *store; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5079 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5080 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5081 if(!handle || !item) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5082 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5083 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5084 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5085 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5086 && GTK_IS_TREE_VIEW(tree) && |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5087 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5088 gtk_tree_store_set(store, (GtkTreeIter *)item, 2, itemdata, -1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5089 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5090 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5091 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5092 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5093 * Gets the text an item in a tree window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5094 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5095 * handle: Handle to the tree containing the item. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5096 * item: Handle of the item to be modified. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5097 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5098 char * API dw_tree_get_title(HWND handle, HTREEITEM item) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5099 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5100 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5101 char *text = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5102 GtkWidget *tree; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5103 GtkTreeModel *store; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5104 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5105 if(!handle || !item) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5106 return text; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5107 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5108 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5109 tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5110 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5111 if(tree && GTK_IS_TREE_VIEW(tree) && |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5112 (store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5113 gtk_tree_model_get(store, (GtkTreeIter *)item, 0, &text, -1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5114 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5115 return text; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5116 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5117 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5118 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5119 * Gets the text an item in a tree window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5120 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5121 * handle: Handle to the tree containing the item. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5122 * item: Handle of the item to be modified. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5123 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5124 HTREEITEM API dw_tree_get_parent(HWND handle, HTREEITEM item) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5125 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5126 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5127 HTREEITEM parent = (HTREEITEM)0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5128 GtkWidget *tree; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5129 GtkTreeModel *store; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5130 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5131 if(!handle || !item) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5132 return parent; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5133 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5134 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5135 tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5136 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5137 if(tree && GTK_IS_TREE_VIEW(tree) && |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5138 (store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5139 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5140 GtkTreeIter *p = malloc(sizeof(GtkTreeIter)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5141 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5142 if(gtk_tree_model_iter_parent(store, p, (GtkTreeIter *)item)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5143 parent = p; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5144 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5145 free(p); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5146 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5147 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5148 return parent; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5149 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5150 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5151 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5152 * Gets the item data of a tree item. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5153 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5154 * handle: Handle to the tree containing the item. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5155 * item: Handle of the item to be modified. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5156 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5157 void *dw_tree_item_get_data(HWND handle, HTREEITEM item) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5158 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5159 void *ret = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5160 GtkWidget *tree; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5161 GtkTreeModel *store; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5162 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5163 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5164 if(!handle || !item) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5165 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5166 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5167 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5168 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5169 && GTK_IS_TREE_VIEW(tree) && |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5170 (store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5171 gtk_tree_model_get(store, (GtkTreeIter *)item, 2, &ret, -1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5172 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5173 return ret; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5174 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5175 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5176 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5177 * Sets this item as the active selection. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5178 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5179 * handle: Handle to the tree window (widget) to be selected. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5180 * item: Handle to the item to be selected. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5181 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5182 void dw_tree_item_select(HWND handle, HTREEITEM item) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5183 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5184 GtkWidget *tree; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5185 GtkTreeStore *store; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5186 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5187 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5188 if(!handle || !item) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5189 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5190 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5191 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5192 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5193 && GTK_IS_TREE_VIEW(tree) && |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5194 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5195 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5196 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), (GtkTreeIter *)item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5197 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5198 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5199 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree), path, NULL, FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5200 gtk_tree_selection_select_iter(sel, (GtkTreeIter *)item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5201 gtk_tree_path_free(path); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5202 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5203 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5204 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5205 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5206 static void _dw_recursive_free(GtkTreeModel *store, GtkTreeIter parent) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5207 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5208 void *data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5209 GtkTreeIter iter; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5210 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5211 gtk_tree_model_get(store, &parent, 3, &data, -1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5212 if(data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5213 free(data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5214 gtk_tree_store_set(GTK_TREE_STORE(store), &parent, 3, NULL, -1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5215 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5216 if(gtk_tree_model_iter_children(store, &iter, &parent)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5217 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5218 do { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5219 _dw_recursive_free(GTK_TREE_MODEL(store), iter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5220 } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5221 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5222 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5223 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5224 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5225 * Removes all nodes from a tree. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5226 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5227 * handle: Handle to the window (widget) to be cleared. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5228 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5229 void dw_tree_clear(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5230 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5231 GtkWidget *tree; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5232 GtkTreeStore *store; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5233 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5234 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5235 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5236 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5237 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5238 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5239 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5240 && GTK_IS_TREE_VIEW(tree) && |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5241 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5242 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5243 GtkTreeIter iter; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5244 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5245 if(gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5246 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5247 do { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5248 _dw_recursive_free(GTK_TREE_MODEL(store), iter); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5249 } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5250 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5251 gtk_tree_store_clear(store); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5252 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5253 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5254 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5255 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5256 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5257 * Expands a node on a tree. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5258 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5259 * handle: Handle to the tree window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5260 * item: Handle to node to be expanded. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5261 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5262 void dw_tree_item_expand(HWND handle, HTREEITEM item) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5263 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5264 GtkWidget *tree; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5265 GtkTreeStore *store; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5266 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5267 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5268 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5269 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5270 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5271 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5272 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5273 && GTK_IS_TREE_VIEW(tree) && |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5274 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5275 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5276 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), (GtkTreeIter *)item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5277 gtk_tree_view_expand_row(GTK_TREE_VIEW(tree), path, FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5278 gtk_tree_path_free(path); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5279 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5280 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5281 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5282 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5283 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5284 * Collapses a node on a tree. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5285 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5286 * handle: Handle to the tree window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5287 * item: Handle to node to be collapsed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5288 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5289 void dw_tree_item_collapse(HWND handle, HTREEITEM item) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5290 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5291 GtkWidget *tree; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5292 GtkTreeStore *store; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5293 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5294 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5295 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5296 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5297 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5298 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5299 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5300 && GTK_IS_TREE_VIEW(tree) && |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5301 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5302 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5303 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), (GtkTreeIter *)item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5304 gtk_tree_view_collapse_row(GTK_TREE_VIEW(tree), path); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5305 gtk_tree_path_free(path); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5306 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5307 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5308 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5309 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5310 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5311 * Removes a node from a tree. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5312 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5313 * handle: Handle to the window (widget) to be cleared. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5314 * item: Handle to node to be deleted. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5315 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5316 void dw_tree_item_delete(HWND handle, HTREEITEM item) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5317 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5318 GtkWidget *tree; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5319 GtkTreeStore *store; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5320 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5321 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5322 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5323 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5324 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5325 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5326 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5327 && GTK_IS_TREE_VIEW(tree) && |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5328 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5329 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5330 gtk_tree_store_remove(store, (GtkTreeIter *)item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5331 free(item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5332 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5333 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5334 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5335 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5336 static int _dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator, int extra) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5337 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5338 int z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5339 GtkWidget *tree; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5340 GtkListStore *store; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5341 GtkTreeViewColumn *col; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5342 GtkCellRenderer *rend; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5343 GtkTreeSelection *sel; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5344 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5345 GType *array = calloc(count, sizeof(gint)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5346 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5347 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5348 /* First loop... create array to create the store */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5349 for(z=0;z<count;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5350 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5351 if(flags[z] & DW_CFA_BITMAPORICON) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5352 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5353 array[z] = GDK_TYPE_PIXBUF; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5354 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5355 else if(flags[z] & DW_CFA_STRING) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5356 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5357 array[z] = G_TYPE_STRING; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5358 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5359 else if(flags[z] & DW_CFA_ULONG) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5360 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5361 array[z] = G_TYPE_ULONG; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5362 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5363 else if(flags[z] & DW_CFA_TIME) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5364 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5365 array[z] = G_TYPE_STRING; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5366 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5367 else if(flags[z] & DW_CFA_DATE) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5368 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5369 array[z] = G_TYPE_STRING; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5370 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5371 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5372 /* Create the store and then the tree */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5373 store = gtk_list_store_newv(count, array); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5374 tree = _tree_setup(handle, GTK_TREE_MODEL(store)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5375 /* Second loop... create the columns */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5376 for(z=0;z<count;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5377 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5378 col = gtk_tree_view_column_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5379 if(flags[z] & DW_CFA_BITMAPORICON) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5380 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5381 rend = gtk_cell_renderer_pixbuf_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5382 gtk_tree_view_column_pack_start(col, rend, FALSE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5383 gtk_tree_view_column_add_attribute(col, rend, "pixbuf", z); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5384 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5385 else if(flags[z] & DW_CFA_STRING) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5386 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5387 rend = gtk_cell_renderer_text_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5388 gtk_tree_view_column_pack_start(col, rend, TRUE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5389 gtk_tree_view_column_add_attribute(col, rend, "text", z); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5390 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5391 else if(flags[z] & DW_CFA_ULONG) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5392 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5393 rend = gtk_cell_renderer_text_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5394 gtk_tree_view_column_pack_start(col, rend, TRUE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5395 gtk_tree_view_column_add_attribute(col, rend, "text", z); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5396 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5397 else if(flags[z] & DW_CFA_TIME) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5398 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5399 rend = gtk_cell_renderer_text_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5400 gtk_tree_view_column_pack_start(col, rend, TRUE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5401 gtk_tree_view_column_add_attribute(col, rend, "text", z); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5402 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5403 else if(flags[z] & DW_CFA_DATE) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5404 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5405 rend = gtk_cell_renderer_text_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5406 gtk_tree_view_column_pack_start(col, rend, TRUE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5407 gtk_tree_view_column_add_attribute(col, rend, "text", z); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5408 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5409 gtk_tree_view_append_column(GTK_TREE_VIEW (tree), col); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5410 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(tree), col); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5411 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5412 /* Finish up */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5413 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), TRUE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5414 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5415 if(g_object_get_data(G_OBJECT(handle), "_dw_multi_sel")) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5416 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5417 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5418 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5419 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5420 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5421 gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5422 } |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
5423 gtk_widget_show(tree); |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5424 free(array); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5425 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5426 return TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5427 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5428 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5429 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5430 * Sets up the container columns. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5431 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5432 * handle: Handle to the container to be configured. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5433 * flags: An array of unsigned longs with column flags. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5434 * titles: An array of strings with column text titles. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5435 * count: The number of columns (this should match the arrays). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5436 * separator: The column number that contains the main separator. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5437 * (this item may only be used in OS/2) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5438 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5439 int dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5440 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5441 return _dw_container_setup(handle, flags, titles, count, separator, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5442 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5443 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5444 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5445 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5446 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5447 * handle: Handle to the container to be configured. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5448 * flags: An array of unsigned longs with column flags. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5449 * titles: An array of strings with column text titles. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5450 * count: The number of columns (this should match the arrays). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5451 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5452 int dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5453 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5454 char **newtitles = malloc(sizeof(char *) * (count + 2)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5455 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5456 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5457 newtitles[0] = "Filename"; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5458 newflags[0] = DW_CFA_STRINGANDICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5459 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5460 memcpy(&newtitles[2], titles, sizeof(char *) * count); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5461 memcpy(&newflags[2], flags, sizeof(unsigned long) * count); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5462 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5463 _dw_container_setup(handle, newflags, newtitles, count + 1, 1, 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5464 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5465 if ( newtitles) free(newtitles); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5466 if ( newflags ) free(newflags); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5467 return TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5468 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5469 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5470 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5471 * Obtains an icon from a module (or header in GTK). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5472 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5473 * module: Handle to module (DLL) in OS/2 and Windows. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5474 * id: A unsigned long id int the resources on OS/2 and |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5475 * Windows, on GTK this is converted to a pointer |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5476 * to an embedded XPM. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5477 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5478 HICN dw_icon_load(unsigned long module, unsigned long id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5479 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5480 return id; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5481 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5482 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5483 HICN _dw_icon_load_internal(GdkPixbuf *pixbuf) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5484 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5485 unsigned long z, ret = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5486 int found = -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5487 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5488 /* Find a free entry in the array */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5489 for (z=0;z<_PixmapCount;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5490 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5491 if (!_PixmapArray[z].used) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5492 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5493 ret = found = z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5494 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5495 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5496 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5497 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5498 /* If there are no free entries, expand the |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5499 * array. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5500 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5501 if (found == -1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5502 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5503 DWPrivatePixmap *old = _PixmapArray; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5504 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5505 ret = found = _PixmapCount; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5506 _PixmapCount++; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5507 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5508 _PixmapArray = malloc(sizeof(DWPrivatePixmap) * _PixmapCount); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5509 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5510 if (found) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5511 memcpy(_PixmapArray, old, sizeof(DWPrivatePixmap) * found); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5512 if (old) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5513 free(old); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5514 _PixmapArray[found].used = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5515 _PixmapArray[found].pixbuf = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5516 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5517 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5518 _PixmapArray[found].pixbuf = pixbuf; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5519 _PixmapArray[found].width = gdk_pixbuf_get_width(pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5520 _PixmapArray[found].height = gdk_pixbuf_get_height(pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5521 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5522 if (!_PixmapArray[found].pixbuf) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5523 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5524 _PixmapArray[found].used = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5525 _PixmapArray[found].pixbuf = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5526 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5527 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5528 return (HICN)ret | (1 << 31); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5529 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5530 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5531 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5532 * Obtains an icon from a file. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5533 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5534 * filename: Name of the file, omit extention to have |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5535 * DW pick the appropriate file extension. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5536 * (ICO on OS/2 or Windows, XPM on Unix) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5537 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5538 HICN API dw_icon_load_from_file(char *filename) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5539 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5540 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5541 GdkPixbuf *pixbuf; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5542 char *file = alloca(strlen(filename) + 5); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5543 int found_ext = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5544 int i, ret = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5545 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5546 if (!file) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5547 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5548 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5549 strcpy(file, filename); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5550 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5551 /* check if we can read from this file (it exists and read permission) */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5552 if (access(file, 04) != 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5553 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5554 /* Try with various extentions */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5555 for ( i = 0; i < NUM_EXTS; i++ ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5556 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5557 strcpy( file, filename ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5558 strcat( file, image_exts[i] ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5559 if ( access( file, 04 ) == 0 ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5560 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5561 found_ext = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5562 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5563 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5564 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5565 if ( found_ext == 0 ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5566 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5567 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5568 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5569 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5570 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5571 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5572 pixbuf = gdk_pixbuf_new_from_file(file, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5573 if (pixbuf) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5574 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5575 ret = _dw_icon_load_internal(pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5576 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5577 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5578 return ret; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5579 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5580 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5581 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5582 * Obtains an icon from data. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5583 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5584 * data: Source of data for image. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5585 * len: length of data |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5586 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5587 HICN API dw_icon_load_from_data(char *data, int len) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5588 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5589 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5590 char *file; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5591 FILE *fp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5592 GdkPixbuf *pixbuf; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5593 unsigned long z, ret = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5594 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5595 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5596 * A real hack; create a temporary file and write the contents |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5597 * of the data to the file |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5598 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5599 file = tmpnam( NULL ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5600 fp = fopen( file, "wb" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5601 if ( fp ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5602 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5603 fwrite( data, len, 1, fp ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5604 fclose( fp ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5605 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5606 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5607 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5608 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5609 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5610 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5611 pixbuf = gdk_pixbuf_new_from_file(file, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5612 if (pixbuf) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5613 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5614 ret = _dw_icon_load_internal(pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5615 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5616 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5617 return ret; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5618 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5619 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5620 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5621 * Frees a loaded resource in OS/2 and Windows. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5622 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5623 * handle: Handle to icon returned by dw_icon_load(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5624 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5625 void dw_icon_free(HICN handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5626 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5627 /* If it is a private icon, find the item |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5628 * free the associated structures and set |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5629 * the entry to unused. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5630 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5631 if(handle & (1 << 31)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5632 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5633 unsigned long id = handle & 0xFFFFFF; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5634 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5635 if(id < _PixmapCount && _PixmapArray[id].used) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5636 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5637 if(_PixmapArray[id].pixbuf) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5638 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5639 g_object_unref(_PixmapArray[id].pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5640 _PixmapArray[id].pixbuf = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5641 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5642 _PixmapArray[id].used = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5643 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5644 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5645 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5646 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5647 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5648 * Allocates memory used to populate a container. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5649 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5650 * handle: Handle to the container window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5651 * rowcount: The number of items to be populated. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5652 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5653 void *dw_container_alloc(HWND handle, int rowcount) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5654 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5655 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5656 int z, count = 0, prevrowcount = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5657 GtkWidget *clist; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5658 GdkColor *fore, *back; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5659 char **blah; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5660 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5661 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5662 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5663 clist = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5664 if(!clist) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5665 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5666 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5667 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5668 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5669 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5670 count = (int)g_object_get_data(G_OBJECT(clist), "_dw_colcount"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5671 prevrowcount = (int)g_object_get_data(G_OBJECT(clist), "_dw_rowcount"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5672 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5673 if(!count) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5674 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5675 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5676 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5677 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5678 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5679 blah = malloc(sizeof(char *) * count); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5680 memset(blah, 0, sizeof(char *) * count); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5681 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5682 fore = (GdkColor *)g_object_get_data(G_OBJECT(clist), "_dw_foregdk"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5683 back = (GdkColor *)g_object_get_data(G_OBJECT(clist), "_dw_backgdk"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5684 gtk_clist_freeze(GTK_CLIST(clist)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5685 for(z=0;z<rowcount;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5686 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5687 gtk_clist_append(GTK_CLIST(clist), blah); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5688 if(fore) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5689 gtk_clist_set_foreground(GTK_CLIST(clist), z + prevrowcount, fore); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5690 if(back) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5691 gtk_clist_set_background(GTK_CLIST(clist), z + prevrowcount, back); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5692 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5693 g_object_set_data(G_OBJECT(clist), "_dw_insertpos", GINT_TO_POINTER(prevrowcount)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5694 g_object_set_data(G_OBJECT(clist), "_dw_rowcount", GINT_TO_POINTER(rowcount + prevrowcount)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5695 free(blah); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5696 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5697 return (void *)handle; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5698 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5699 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5700 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5701 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5702 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5703 * Internal representation of dw_container_set_item() extracted so we can pass |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5704 * two data pointers; icon and text for dw_filesystem_set_item(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5705 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5706 void _dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data, char *text) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5707 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5708 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5709 char numbuf[10], textbuffer[100]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5710 int flag = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5711 GtkWidget *clist; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5712 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5713 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5714 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5715 clist = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5716 if(!clist) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5717 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5718 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5719 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5720 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5721 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5722 sprintf(numbuf, "%d", column); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5723 flag = (int)g_object_get_data(G_OBJECT(clist), numbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5724 row += (int)g_object_get_data(G_OBJECT(clist), "_dw_insertpos"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5725 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5726 if(flag & DW_CFA_BITMAPORICON) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5727 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5728 long hicon = *((long *)data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5729 GdkBitmap *bitmap = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5730 GdkPixmap *pixmap = _find_pixmap(&bitmap, hicon, clist, NULL, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5731 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5732 if(pixmap) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5733 gtk_clist_set_pixmap(GTK_CLIST(clist), row, column, pixmap, bitmap); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5734 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5735 else if(flag & DW_CFA_STRINGANDICON) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5736 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5737 long hicon = *((long *)data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5738 GdkBitmap *bitmap = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5739 GdkPixmap *pixmap = _find_pixmap(&bitmap, hicon, clist, NULL, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5740 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5741 if(pixmap) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5742 gtk_clist_set_pixtext(GTK_CLIST(clist), row, column, text, 2, pixmap, bitmap); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5743 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5744 else if(flag & DW_CFA_STRING) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5745 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5746 char *tmp = *((char **)data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5747 gtk_clist_set_text(GTK_CLIST(clist), row, column, tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5748 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5749 else if(flag & DW_CFA_ULONG) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5750 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5751 ULONG tmp = *((ULONG *)data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5752 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5753 sprintf(textbuffer, "%lu", tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5754 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5755 gtk_clist_set_text(GTK_CLIST(clist), row, column, textbuffer); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5756 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5757 else if(flag & DW_CFA_DATE) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5758 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5759 struct tm curtm; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5760 CDATE cdate = *((CDATE *)data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5761 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5762 memset( &curtm, 0, sizeof(curtm) ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5763 curtm.tm_mday = cdate.day; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5764 curtm.tm_mon = cdate.month - 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5765 curtm.tm_year = cdate.year - 1900; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5766 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5767 strftime(textbuffer, 100, "%x", &curtm); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5768 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5769 gtk_clist_set_text(GTK_CLIST(clist), row, column, textbuffer); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5770 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5771 else if(flag & DW_CFA_TIME) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5772 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5773 struct tm curtm; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5774 CTIME ctime = *((CTIME *)data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5775 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5776 memset( &curtm, 0, sizeof(curtm) ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5777 curtm.tm_hour = ctime.hours; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5778 curtm.tm_min = ctime.minutes; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5779 curtm.tm_sec = ctime.seconds; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5780 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5781 strftime(textbuffer, 100, "%X", &curtm); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5782 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5783 gtk_clist_set_text(GTK_CLIST(clist), row, column, textbuffer); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5784 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5785 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5786 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5787 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5788 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5789 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5790 * Sets an item in specified row and column to the given data. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5791 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5792 * handle: Handle to the container window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5793 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5794 * column: Zero based column of data being set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5795 * row: Zero based row of data being set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5796 * data: Pointer to the data to be added. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5797 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5798 void dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5799 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5800 _dw_container_set_item(handle, NULL, column, row, data, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5801 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5802 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5803 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5804 * Changes an existing item in specified row and column to the given data. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5805 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5806 * handle: Handle to the container window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5807 * column: Zero based column of data being set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5808 * row: Zero based row of data being set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5809 * data: Pointer to the data to be added. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5810 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5811 void dw_container_change_item(HWND handle, int column, int row, void *data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5812 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5813 _dw_container_set_item(handle, NULL, column, row, data, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5814 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5815 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5816 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5817 * Changes an existing item in specified row and column to the given data. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5818 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5819 * handle: Handle to the container window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5820 * column: Zero based column of data being set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5821 * row: Zero based row of data being set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5822 * data: Pointer to the data to be added. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5823 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5824 void API dw_filesystem_change_item(HWND handle, int column, int row, void *data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5825 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5826 dw_filesystem_set_item(handle, NULL, column, row, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5827 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5828 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5829 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5830 * Changes an item in specified row and column to the given data. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5831 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5832 * handle: Handle to the container window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5833 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5834 * column: Zero based column of data being set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5835 * row: Zero based row of data being set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5836 * data: Pointer to the data to be added. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5837 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5838 void API dw_filesystem_change_file(HWND handle, int row, char *filename, HICN icon) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5839 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5840 dw_filesystem_set_file(handle, NULL, row, filename, icon); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5841 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5842 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5843 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5844 * Sets an item in specified row and column to the given data. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5845 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5846 * handle: Handle to the container window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5847 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5848 * column: Zero based column of data being set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5849 * row: Zero based row of data being set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5850 * data: Pointer to the data to be added. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5851 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5852 void dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, HICN icon) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5853 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5854 _dw_container_set_item(handle, pointer, 0, row, (void *)&icon, filename); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5855 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5856 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5857 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5858 * Sets an item in specified row and column to the given data. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5859 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5860 * handle: Handle to the container window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5861 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5862 * column: Zero based column of data being set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5863 * row: Zero based row of data being set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5864 * data: Pointer to the data to be added. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5865 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5866 void dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5867 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5868 _dw_container_set_item(handle, pointer, column + 1, row, data, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5869 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5870 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5871 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5872 * Gets column type for a container column |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5873 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5874 * handle: Handle to the container window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5875 * column: Zero based column. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5876 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5877 int dw_container_get_column_type(HWND handle, int column) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5878 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5879 char numbuf[10]; |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
5880 int flag, rc = 0; |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5881 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5882 GtkWidget *clist; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5883 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5884 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5885 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5886 clist = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5887 if(!clist) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5888 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5889 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5890 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5891 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5892 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5893 sprintf(numbuf, "%d", column); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5894 flag = (int)g_object_get_data(G_OBJECT(clist), numbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5895 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5896 if(flag & DW_CFA_BITMAPORICON) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5897 rc = DW_CFA_BITMAPORICON; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5898 else if(flag & DW_CFA_STRING) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5899 rc = DW_CFA_STRING; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5900 else if(flag & DW_CFA_ULONG) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5901 rc = DW_CFA_ULONG; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5902 else if(flag & DW_CFA_DATE) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5903 rc = DW_CFA_DATE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5904 else if(flag & DW_CFA_TIME) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5905 rc = DW_CFA_TIME; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5906 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5907 rc = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5908 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5909 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5910 return rc; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5911 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5912 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5913 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5914 * Gets column type for a filesystem container column |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5915 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5916 * handle: Handle to the container window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5917 * column: Zero based column. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5918 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5919 int API dw_filesystem_get_column_type(HWND handle, int column) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5920 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5921 return dw_container_get_column_type( handle, column + 1 ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5922 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5923 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5924 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5925 * Sets the width of a column in the container. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5926 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5927 * handle: Handle to window (widget) of container. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5928 * column: Zero based column of width being set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5929 * width: Width of column in pixels. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5930 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5931 void dw_container_set_column_width(HWND handle, int column, int width) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5932 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5933 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5934 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5935 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5936 * Sets the title of a row in the container. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5937 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5938 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5939 * row: Zero based row of data being set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5940 * title: String title of the item. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5941 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5942 void dw_container_set_row_title(void *pointer, int row, char *title) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5943 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5944 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5945 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5946 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5947 * Sets the title of a row in the container. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5948 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5949 * handle: Handle to the container window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5950 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5951 * rowcount: The number of rows to be inserted. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5952 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5953 void dw_container_insert(HWND handle, void *pointer, int rowcount) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5954 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5955 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5956 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5957 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5958 * Removes the first x rows from a container. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5959 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5960 * handle: Handle to the window (widget) to be deleted from. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5961 * rowcount: The number of rows to be deleted. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5962 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5963 void dw_container_delete(HWND handle, int rowcount) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5964 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5965 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5966 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5967 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5968 * Removes all rows from a container. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5969 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5970 * handle: Handle to the window (widget) to be cleared. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5971 * redraw: TRUE to cause the container to redraw immediately. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5972 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5973 void dw_container_clear(HWND handle, int redraw) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5974 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5975 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5976 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5977 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5978 * Scrolls container up or down. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5979 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5980 * handle: Handle to the window (widget) to be scrolled. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5981 * direction: DW_SCROLL_UP, DW_SCROLL_DOWN, DW_SCROLL_TOP or |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5982 * DW_SCROLL_BOTTOM. (rows is ignored for last two) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5983 * rows: The number of rows to be scrolled. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5984 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5985 void dw_container_scroll(HWND handle, int direction, long rows) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5986 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5987 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5988 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5989 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5990 * Starts a new query of a container. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5991 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5992 * handle: Handle to the window (widget) to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5993 * flags: If this parameter is DW_CRA_SELECTED it will only |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5994 * return items that are currently selected. Otherwise |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5995 * it will return all records in the container. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5996 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5997 char *dw_container_query_start(HWND handle, unsigned long flags) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5998 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5999 char *retval = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6000 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6001 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6002 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6003 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6004 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6005 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6006 * Continues an existing query of a container. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6007 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6008 * handle: Handle to the window (widget) to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6009 * flags: If this parameter is DW_CRA_SELECTED it will only |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6010 * return items that are currently selected. Otherwise |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6011 * it will return all records in the container. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6012 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6013 char *dw_container_query_next(HWND handle, unsigned long flags) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6014 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6015 char *retval = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6016 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6017 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6018 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6019 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6020 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6021 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6022 * Cursors the item with the text speficied, and scrolls to that item. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6023 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6024 * handle: Handle to the window (widget) to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6025 * text: Text usually returned by dw_container_query(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6026 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6027 void dw_container_cursor(HWND handle, char *text) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6028 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6029 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6030 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6031 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6032 * Deletes the item with the text speficied. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6033 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6034 * handle: Handle to the window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6035 * text: Text usually returned by dw_container_query(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6036 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6037 void dw_container_delete_row(HWND handle, char *text) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6038 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6039 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6040 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6041 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6042 * Optimizes the column widths so that all data is visible. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6043 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6044 * handle: Handle to the window (widget) to be optimized. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6045 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6046 void dw_container_optimize(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6047 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6048 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6049 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6050 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6051 * Inserts an icon into the taskbar. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6052 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6053 * handle: Window handle that will handle taskbar icon messages. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6054 * icon: Icon handle to display in the taskbar. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6055 * bubbletext: Text to show when the mouse is above the icon. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6056 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6057 void dw_taskbar_insert(HWND handle, HICN icon, char *bubbletext) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6058 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6059 /* TODO */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6060 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6061 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6062 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6063 * Deletes an icon from the taskbar. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6064 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6065 * handle: Window handle that was used with dw_taskbar_insert(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6066 * icon: Icon handle that was used with dw_taskbar_insert(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6067 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6068 void dw_taskbar_delete(HWND handle, HICN icon) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6069 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6070 /* TODO */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6071 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6072 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6073 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6074 * Creates a rendering context widget (window) to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6075 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6076 * id: An id to be used with dw_window_from_id. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6077 * Returns: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6078 * A handle to the widget or NULL on failure. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6079 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6080 HWND dw_render_new(unsigned long id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6081 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6082 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6083 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6084 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6085 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6086 tmp = gtk_drawing_area_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6087 gtk_widget_set_events(tmp, GDK_EXPOSURE_MASK |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6088 | GDK_LEAVE_NOTIFY_MASK |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6089 | GDK_BUTTON_PRESS_MASK |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6090 | GDK_BUTTON_RELEASE_MASK |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6091 | GDK_KEY_PRESS_MASK |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6092 | GDK_POINTER_MOTION_MASK |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6093 | GDK_POINTER_MOTION_HINT_MASK); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6094 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6095 gtk_widget_set_can_focus(tmp, TRUE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6096 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6097 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6098 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6099 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6100 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6101 /* Returns a GdkColor from a DW color */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6102 static GdkColor _internal_color(unsigned long value) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6103 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6104 if(DW_RGB_COLOR & value) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6105 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6106 GdkColor color = { 0, DW_RED_VALUE(value) << 8, DW_GREEN_VALUE(value) << 8, DW_BLUE_VALUE(value) << 8 }; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6107 return color; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6108 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6109 if (value < 16) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6110 return _colors[value]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6111 return _colors[0]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6112 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6113 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6114 /* Sets the current foreground drawing color. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6115 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6116 * red: red value. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6117 * green: green value. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6118 * blue: blue value. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6119 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6120 void dw_color_foreground_set(unsigned long value) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6121 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6122 int _locked_by_me = FALSE, index = _find_thread_index(dw_thread_id()); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6123 GdkColor color = _internal_color(value); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6124 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6125 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6126 _foreground[index] = color; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6127 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6128 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6129 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6130 /* Sets the current background drawing color. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6131 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6132 * red: red value. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6133 * green: green value. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6134 * blue: blue value. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6135 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6136 void dw_color_background_set(unsigned long value) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6137 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6138 int _locked_by_me = FALSE, index = _find_thread_index(dw_thread_id()); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6139 GdkColor color = _internal_color(value); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6140 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6141 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6142 if(value == DW_CLR_DEFAULT) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6143 _transparent[index] = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6144 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6145 _transparent[index] = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6146 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6147 _background[index] = color; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6148 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6149 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6150 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6151 /* Internal function to handle the color OK press */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6152 static gint _gtk_color_ok(GtkWidget *widget, DWDialog *dwwait) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6153 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6154 GdkColor color; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6155 unsigned long dw_color; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6156 GtkColorSelection *colorsel; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6157 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6158 if(!dwwait) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6159 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6160 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6161 colorsel = (GtkColorSelection *)gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(dwwait->data)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6162 gtk_color_selection_get_current_color(colorsel, &color); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6163 gtk_widget_destroy(GTK_WIDGET(dwwait->data)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6164 _dw_color_active = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6165 dw_color = DW_RGB( (color.red & 0xFF), (color.green & 0xFF), (color.blue & 0xFF)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6166 dw_dialog_dismiss(dwwait, (void *)dw_color); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6167 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6168 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6169 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6170 /* Internal function to handle the color Cancel press */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6171 static gint _gtk_color_cancel(GtkWidget *widget, DWDialog *dwwait) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6172 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6173 if(!dwwait) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6174 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6175 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6176 gtk_widget_destroy(GTK_WIDGET(dwwait->data)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6177 _dw_color_active = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6178 dw_dialog_dismiss(dwwait, (void *)-1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6179 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6180 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6181 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6182 /* Allows the user to choose a color using the system's color chooser dialog. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6183 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6184 * value: current color |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6185 * Returns: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6186 * The selected color or the current color if cancelled. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6187 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6188 unsigned long API dw_color_choose(unsigned long value) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6189 { |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
6190 GtkWidget *colorw, *ok_button, *cancel_button; |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6191 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6192 DWDialog *dwwait; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6193 GtkColorSelection *colorsel; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6194 GdkColor color = _internal_color(value); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6195 GObject *part; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6196 unsigned long dw_color; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6197 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6198 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6199 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6200 /* The DW mutex should be sufficient for |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6201 * insuring no thread changes this unknowingly. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6202 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6203 if(_dw_color_active) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6204 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6205 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6206 return value; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6207 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6208 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6209 _dw_color_active = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6210 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6211 colorw = gtk_color_selection_dialog_new("Select Color"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6212 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6213 dwwait = dw_dialog_new((void *)colorw); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6214 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6215 colorsel = (GtkColorSelection *)gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(colorw)); |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
6216 g_object_get(G_OBJECT(colorw), "ok-button", &ok_button, "cancel-button", &cancel_button, NULL); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
6217 g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(_gtk_color_ok), dwwait); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
6218 g_signal_connect(G_OBJECT(cancel_button), "clicked", G_CALLBACK(_gtk_color_cancel), dwwait); |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6219 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6220 gtk_color_selection_set_previous_color(colorsel,&color); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6221 gtk_color_selection_set_current_color(colorsel,&color); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6222 gtk_color_selection_set_has_palette(colorsel,TRUE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6223 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6224 gtk_widget_show(colorw); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6225 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6226 dw_color = (unsigned long)dw_dialog_wait(dwwait); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6227 if ((unsigned long)dw_color == -1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6228 dw_color = value; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6229 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6230 return (unsigned long)dw_color; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6231 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6232 dw_messagebox("Not implemented", DW_MB_OK|DW_MB_INFORMATION, "This feature not yet supported."); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6233 return value; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6234 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6235 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6236 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6237 /* Draw a point on a window (preferably a render window). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6238 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6239 * handle: Handle to the window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6240 * pixmap: Handle to the pixmap. (choose only one of these) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6241 * x: X coordinate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6242 * y: Y coordinate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6243 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6244 void dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6245 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6246 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6247 cairo_t *cr = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6248 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6249 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6250 if(handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6251 cr = gdk_cairo_create(gtk_widget_get_window(handle)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6252 #if 0 /* TODO */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6253 else if(pixmap) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6254 gc = _set_colors(pixmap->pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6255 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6256 if(cr) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6257 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6258 int index = _find_thread_index(dw_thread_id()); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6259 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6260 cairo_set_source_rgb(cr, _foreground[index].red, _foreground[index].green, _foreground[index].blue); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6261 cairo_set_line_width(cr, 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6262 cairo_move_to(cr, x, y); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6263 cairo_stroke(cr); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6264 cairo_destroy(cr); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6265 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6266 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6267 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6268 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6269 /* Draw a line on a window (preferably a render window). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6270 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6271 * handle: Handle to the window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6272 * pixmap: Handle to the pixmap. (choose only one of these) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6273 * x1: First X coordinate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6274 * y1: First Y coordinate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6275 * x2: Second X coordinate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6276 * y2: Second Y coordinate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6277 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6278 void dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6279 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6280 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6281 cairo_t *cr = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6282 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6283 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6284 if(handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6285 cr = gdk_cairo_create(gtk_widget_get_window(handle)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6286 #if 0 /* TODO */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6287 else if(pixmap) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6288 gc = _set_colors(pixmap->pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6289 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6290 if(cr) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6291 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6292 int index = _find_thread_index(dw_thread_id()); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6293 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6294 cairo_set_source_rgb(cr, _foreground[index].red, _foreground[index].green, _foreground[index].blue); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6295 cairo_set_line_width(cr, 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6296 cairo_move_to(cr, x1, y1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6297 cairo_line_to(cr, x2, y2); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6298 cairo_stroke(cr); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6299 cairo_destroy(cr); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6300 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6301 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6302 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6303 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6304 /* Draw a closed polygon on a window (preferably a render window). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6305 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6306 * handle: Handle to the window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6307 * pixmap: Handle to the pixmap. (choose only one of these) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6308 * fill: if true filled |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6309 * number of points |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6310 * x[]: X coordinates. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6311 * y[]: Y coordinates. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6312 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6313 void dw_draw_polygon(HWND handle, HPIXMAP pixmap, int fill, int npoints, int *x, int *y) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6314 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6315 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6316 cairo_t *cr = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6317 int z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6318 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6319 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6320 if(handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6321 cr = gdk_cairo_create(gtk_widget_get_window(handle)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6322 #if 0 /* TODO */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6323 else if(pixmap) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6324 gc = _set_colors(pixmap->pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6325 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6326 if(cr) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6327 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6328 int index = _find_thread_index(dw_thread_id()); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6329 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6330 cairo_set_source_rgb(cr, _foreground[index].red, _foreground[index].green, _foreground[index].blue); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6331 cairo_set_line_width(cr, 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6332 cairo_move_to(cr, x[0], y[0]); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6333 for(z=1;z<npoints;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6334 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6335 cairo_line_to(cr, x[z], y[z]); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6336 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6337 if(fill) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6338 cairo_fill(cr); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6339 cairo_stroke(cr); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6340 cairo_destroy(cr); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6341 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6342 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6343 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6344 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6345 /* Draw a rectangle on a window (preferably a render window). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6346 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6347 * handle: Handle to the window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6348 * pixmap: Handle to the pixmap. (choose only one of these) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6349 * fill: if true filled |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6350 * x: X coordinate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6351 * y: Y coordinate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6352 * width: Width of rectangle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6353 * height: Height of rectangle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6354 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6355 void dw_draw_rect(HWND handle, HPIXMAP pixmap, int fill, int x, int y, int width, int height) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6356 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6357 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6358 cairo_t *cr = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6359 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6360 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6361 if(handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6362 cr = gdk_cairo_create(gtk_widget_get_window(handle)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6363 #if 0 /* TODO */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6364 else if(pixmap) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6365 gc = _set_colors(pixmap->pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6366 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6367 if(cr) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6368 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6369 int index = _find_thread_index(dw_thread_id()); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6370 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6371 cairo_set_source_rgb(cr, _foreground[index].red, _foreground[index].green, _foreground[index].blue); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6372 cairo_set_line_width(cr, 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6373 cairo_move_to(cr, x, y); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6374 cairo_line_to(cr, x, y + height); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6375 cairo_line_to(cr, x + width, y + height); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6376 cairo_line_to(cr, x + width, y); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6377 if(fill) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6378 cairo_fill(cr); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6379 cairo_stroke(cr); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6380 cairo_destroy(cr); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6381 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6382 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6383 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6384 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6385 /* Draw text on a window (preferably a render window). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6386 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6387 * handle: Handle to the window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6388 * pixmap: Handle to the pixmap. (choose only one of these) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6389 * x: X coordinate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6390 * y: Y coordinate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6391 * text: Text to be displayed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6392 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6393 void dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, char *text) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6394 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6395 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6396 cairo_t *cr = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6397 PangoFontDescription *font; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6398 char *fontname = "fixed"; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6399 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6400 if(!text) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6401 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6402 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6403 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6404 if(handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6405 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6406 cr = gdk_cairo_create(gtk_widget_get_window(handle)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6407 fontname = (char *)g_object_get_data(G_OBJECT(handle), "_dw_fontname"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6408 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6409 #if 0 /* TODO */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6410 else if(pixmap) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6411 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6412 fontname = (char *)g_object_get_data(G_OBJECT(pixmap->handle), "_dw_fontname"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6413 gc = _set_colors(pixmap->pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6414 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6415 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6416 if(cr) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6417 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6418 font = pango_font_description_from_string(fontname); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6419 if(font) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6420 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6421 PangoContext *context = pango_cairo_create_context(cr); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6422 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6423 if(context) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6424 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6425 PangoLayout *layout = pango_layout_new(context); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6426 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6427 if(layout) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6428 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6429 int index = _find_thread_index(dw_thread_id()); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6430 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6431 pango_layout_set_font_description(layout, font); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6432 pango_layout_set_text(layout, text, strlen(text)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6433 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6434 cairo_set_source_rgb(cr, _foreground[index].red, _foreground[index].green, _foreground[index].blue); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6435 cairo_move_to(cr, x, y); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6436 pango_cairo_show_layout (cr, layout); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6437 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6438 g_object_unref(layout); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6439 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6440 g_object_unref(context); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6441 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6442 pango_font_description_free(font); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6443 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6444 cairo_destroy(cr); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6445 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6446 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6447 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6448 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6449 /* Query the width and height of a text string. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6450 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6451 * handle: Handle to the window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6452 * pixmap: Handle to the pixmap. (choose only one of these) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6453 * text: Text to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6454 * width: Pointer to a variable to be filled in with the width. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6455 * height Pointer to a variable to be filled in with the height. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6456 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6457 void dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, char *text, int *width, int *height) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6458 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6459 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6460 PangoFontDescription *font; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6461 char *fontname = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6462 int free_fontname = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6463 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6464 if(!text) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6465 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6466 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6467 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6468 if(handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6469 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6470 fontname = (char *)g_object_get_data(G_OBJECT(handle), "_dw_fontname"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6471 if ( fontname == NULL ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6472 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6473 fontname = dw_window_get_font(handle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6474 free_fontname = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6475 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6476 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6477 else if(pixmap) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6478 fontname = (char *)g_object_get_data(G_OBJECT(pixmap->handle), "_dw_fontname"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6479 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6480 font = pango_font_description_from_string(fontname ? fontname : "monospace 10"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6481 if(font) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6482 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6483 PangoContext *context = gdk_pango_context_get(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6484 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6485 if(context) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6486 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6487 PangoLayout *layout = pango_layout_new(context); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6488 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6489 if(layout) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6490 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6491 PangoRectangle rect; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6492 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6493 pango_layout_set_font_description(layout, font); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6494 pango_layout_set_text(layout, text, -1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6495 pango_layout_get_pixel_extents(layout, NULL, &rect); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6496 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6497 if(width) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6498 *width = rect.width; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6499 if(height) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6500 *height = rect.height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6501 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6502 g_object_unref(layout); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6503 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6504 g_object_unref(context); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6505 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6506 pango_font_description_free(font); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6507 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6508 if ( free_fontname ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6509 free( fontname ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6510 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6511 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6512 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6513 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6514 * Creates a pixmap with given parameters. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6515 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6516 * handle: Window handle the pixmap is associated with. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6517 * or zero to enable this pixmap to be written |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6518 * off the screen to reduce flicker |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6519 * width: Width of the pixmap in pixels. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6520 * height: Height of the pixmap in pixels. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6521 * depth: Color depth of the pixmap. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6522 * Returns: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6523 * A handle to a pixmap or NULL on failure. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6524 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6525 HPIXMAP dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6526 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6527 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6528 HPIXMAP pixmap; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6529 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6530 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6531 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6532 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6533 if (!depth) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6534 depth = -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6535 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6536 pixmap->width = width; pixmap->height = height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6537 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6538 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6539 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6540 pixmap->handle = handle; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6541 /* Depth needs to be divided by 3... but for the RGB colorspace... |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6542 * only 8 bits per sample is allowed, so to avoid issues just pass 8 for now. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6543 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6544 if ( handle ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6545 pixmap->pixbuf = gdk_pixbuf_new( GDK_COLORSPACE_RGB, FALSE, 8, width, height ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6546 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6547 pixmap->pixbuf = gdk_pixbuf_new( GDK_COLORSPACE_RGB, FALSE, 8, width, height ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6548 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6549 return pixmap; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6550 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6551 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6552 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6553 * Creates a pixmap from a file. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6554 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6555 * handle: Window handle the pixmap is associated with. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6556 * filename: Name of the file, omit extention to have |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6557 * DW pick the appropriate file extension. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6558 * (BMP on OS/2 or Windows, XPM on Unix) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6559 * Returns: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6560 * A handle to a pixmap or NULL on failure. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6561 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6562 HPIXMAP dw_pixmap_new_from_file(HWND handle, char *filename) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6563 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6564 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6565 HPIXMAP pixmap; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6566 char *file = alloca(strlen(filename) + 5); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6567 int found_ext = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6568 int i; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6569 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6570 if (!file || !(pixmap = calloc(1,sizeof(struct _hpixmap)))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6571 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6572 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6573 strcpy(file, filename); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6574 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6575 /* check if we can read from this file (it exists and read permission) */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6576 if(access(file, 04) != 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6577 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6578 /* Try with various extentions */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6579 for ( i = 0; i < NUM_EXTS; i++ ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6580 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6581 strcpy( file, filename ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6582 strcat( file, image_exts[i] ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6583 if ( access( file, 04 ) == 0 ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6584 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6585 found_ext = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6586 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6587 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6588 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6589 if ( found_ext == 0 ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6590 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6591 free(pixmap); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6592 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6593 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6594 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6595 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6596 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6597 pixmap->pixbuf = gdk_pixbuf_new_from_file(file, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6598 pixmap->width = gdk_pixbuf_get_width(pixmap->pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6599 pixmap->height = gdk_pixbuf_get_height(pixmap->pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6600 pixmap->handle = handle; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6601 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6602 return pixmap; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6603 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6604 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6605 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6606 * Creates a pixmap from data |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6607 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6608 * handle: Window handle the pixmap is associated with. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6609 * data: Source of image data |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6610 * DW pick the appropriate file extension. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6611 * (BMP on OS/2 or Windows, XPM on Unix) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6612 * Returns: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6613 * A handle to a pixmap or NULL on failure. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6614 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6615 HPIXMAP dw_pixmap_new_from_data(HWND handle, char *data, int len) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6616 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6617 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6618 char *file; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6619 FILE *fp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6620 HPIXMAP pixmap; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6621 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6622 if (!data || !(pixmap = calloc(1,sizeof(struct _hpixmap)))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6623 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6624 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6625 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6626 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6627 * A real hack; create a temporary file and write the contents |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6628 * of the data to the file |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6629 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6630 file = tmpnam( NULL ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6631 fp = fopen( file, "wb" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6632 if ( fp ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6633 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6634 fwrite( data, len, 1, fp ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6635 fclose( fp ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6636 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6637 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6638 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6639 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6640 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6641 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6642 pixmap->pixbuf = gdk_pixbuf_new_from_file(file, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6643 pixmap->width = gdk_pixbuf_get_width(pixmap->pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6644 pixmap->height = gdk_pixbuf_get_height(pixmap->pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6645 /* remove our temporary file */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6646 unlink (file ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6647 pixmap->handle = handle; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6648 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6649 return pixmap; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6650 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6651 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6652 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6653 * Sets the transparent color for a pixmap |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6654 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6655 * pixmap: Handle to a pixmap returned by |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6656 * dw_pixmap_new.. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6657 * color: transparent color |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6658 * Note: This does nothing on GTK+ as transparency |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6659 * is handled automatically |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6660 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6661 void dw_pixmap_set_transparent_color(HPIXMAP pixmap, unsigned long color) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6662 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6663 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6664 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6665 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6666 pixmap = pixmap; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6667 color = color; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6668 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6669 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6670 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6671 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6672 * Creates a pixmap from internal resource graphic specified by id. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6673 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6674 * handle: Window handle the pixmap is associated with. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6675 * id: Resource ID associated with requested pixmap. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6676 * Returns: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6677 * A handle to a pixmap or NULL on failure. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6678 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6679 HPIXMAP dw_pixmap_grab(HWND handle, ULONG id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6680 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6681 HPIXMAP pixmap; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6682 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6683 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6684 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6685 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6686 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6687 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6688 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6689 pixmap->pixbuf = gdk_pixbuf_copy(_find_pixbuf(id, &pixmap->width, &pixmap->height)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6690 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6691 return pixmap; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6692 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6693 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6694 /* Call this after drawing to the screen to make sure |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6695 * anything you have drawn is visible. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6696 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6697 void dw_flush(void) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6698 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6699 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6700 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6701 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6702 * Destroys an allocated pixmap. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6703 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6704 * pixmap: Handle to a pixmap returned by |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6705 * dw_pixmap_new.. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6706 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6707 void dw_pixmap_destroy(HPIXMAP pixmap) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6708 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6709 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6710 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6711 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6712 g_object_unref(G_OBJECT(pixmap->pixbuf)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6713 free(pixmap); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6714 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6715 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6716 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6717 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6718 * Copies from one item to another. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6719 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6720 * dest: Destination window handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6721 * destp: Destination pixmap. (choose only one). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6722 * xdest: X coordinate of destination. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6723 * ydest: Y coordinate of destination. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6724 * width: Width of area to copy. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6725 * height: Height of area to copy. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6726 * src: Source window handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6727 * srcp: Source pixmap. (choose only one). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6728 * xsrc: X coordinate of source. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6729 * ysrc: Y coordinate of source. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6730 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6731 void dw_pixmap_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6732 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6733 /* Ok, these #ifdefs are going to get a bit confusing because |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6734 * when using gdk-pixbuf, pixmaps are really pixbufs, so we |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6735 * have to use the pixbuf functions on them, and thus convoluting |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6736 * the code here a bit. -Brian |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6737 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6738 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6739 cairo_t *cr = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6740 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6741 if((!dest && (!destp || !destp->pixbuf)) || (!src && (!srcp || !srcp->pixbuf))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6742 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6743 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6744 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6745 if(dest) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6746 cr = gdk_cairo_create(gtk_widget_get_window(dest)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6747 #if 0 /* TODO */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6748 else if(destp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6749 gc = gdk_gc_new(destp->pixbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6750 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6751 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6752 if(cr) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6753 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6754 if(src) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6755 gdk_cairo_set_source_window (cr, gtk_widget_get_window(src), xsrc, ysrc); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6756 else if(srcp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6757 gdk_cairo_set_source_pixbuf (cr, srcp->pixbuf, xsrc, ysrc); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6758 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6759 cairo_paint(cr); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6760 cairo_destroy(cr); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6761 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6762 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6763 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6764 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6765 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6766 * Emits a beep. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6767 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6768 * freq: Frequency. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6769 * dur: Duration. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6770 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6771 void dw_beep(int freq, int dur) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6772 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6773 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6774 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6775 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6776 gdk_beep(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6777 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6778 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6779 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6780 void _my_strlwr(char *buf) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6781 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6782 int z, len = strlen(buf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6783 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6784 for(z=0;z<len;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6785 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6786 if(buf[z] >= 'A' && buf[z] <= 'Z') |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6787 buf[z] -= 'A' - 'a'; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6788 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6789 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6790 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6791 /* Open a shared library and return a handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6792 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6793 * name: Base name of the shared library. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6794 * handle: Pointer to a module handle, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6795 * will be filled in with the handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6796 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6797 int dw_module_load(char *name, HMOD *handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6798 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6799 int len; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6800 char *newname; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6801 char errorbuf[1024]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6802 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6803 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6804 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6805 return -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6806 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6807 if((len = strlen(name)) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6808 return -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6809 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6810 /* Lenth + "lib" + ".so" + NULL */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6811 newname = malloc(len + 7); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6812 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6813 if(!newname) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6814 return -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6815 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6816 sprintf(newname, "lib%s.so", name); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6817 _my_strlwr(newname); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6818 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6819 *handle = dlopen(newname, RTLD_NOW); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6820 if(*handle == NULL) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6821 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6822 strncpy(errorbuf, dlerror(), 1024); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6823 printf("%s\n", errorbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6824 sprintf(newname, "lib%s.so", name); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6825 *handle = dlopen(newname, RTLD_NOW); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6826 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6827 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6828 free(newname); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6829 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6830 return (NULL == *handle) ? -1 : 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6831 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6832 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6833 /* Queries the address of a symbol within open handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6834 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6835 * handle: Module handle returned by dw_module_load() |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6836 * name: Name of the symbol you want the address of. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6837 * func: A pointer to a function pointer, to obtain |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6838 * the address. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6839 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6840 int dw_module_symbol(HMOD handle, char *name, void**func) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6841 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6842 if(!func || !name) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6843 return -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6844 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6845 if(strlen(name) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6846 return -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6847 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6848 *func = (void*)dlsym(handle, name); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6849 return (NULL == *func); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6850 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6851 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6852 /* Frees the shared library previously opened. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6853 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6854 * handle: Module handle returned by dw_module_load() |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6855 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6856 int dw_module_close(HMOD handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6857 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6858 if(handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6859 return dlclose(handle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6860 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6861 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6862 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6863 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6864 * Returns the handle to an unnamed mutex semaphore. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6865 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6866 HMTX dw_mutex_new(void) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6867 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6868 HMTX mutex = malloc(sizeof(pthread_mutex_t)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6869 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6870 pthread_mutex_init(mutex, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6871 return mutex; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6872 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6873 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6874 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6875 * Closes a semaphore created by dw_mutex_new(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6876 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6877 * mutex: The handle to the mutex returned by dw_mutex_new(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6878 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6879 void dw_mutex_close(HMTX mutex) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6880 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6881 if(mutex) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6882 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6883 pthread_mutex_destroy(mutex); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6884 free(mutex); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6885 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6886 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6887 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6888 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6889 * Tries to gain access to the semaphore, if it can't it blocks. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6890 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6891 * mutex: The handle to the mutex returned by dw_mutex_new(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6892 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6893 void dw_mutex_lock(HMTX mutex) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6894 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6895 /* If we are being called from an event handler we must release |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6896 * the GTK mutex so we don't deadlock. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6897 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6898 if(pthread_self() == _dw_thread) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6899 gdk_threads_leave(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6900 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6901 pthread_mutex_lock(mutex); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6902 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6903 /* And of course relock it when we have acquired the mutext */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6904 if(pthread_self() == _dw_thread) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6905 gdk_threads_enter(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6906 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6907 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6908 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6909 * Reliquishes the access to the semaphore. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6910 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6911 * mutex: The handle to the mutex returned by dw_mutex_new(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6912 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6913 void dw_mutex_unlock(HMTX mutex) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6914 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6915 pthread_mutex_unlock(mutex); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6916 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6917 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6918 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6919 * Returns the handle to an unnamed event semaphore. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6920 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6921 HEV dw_event_new(void) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6922 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6923 HEV eve = (HEV)malloc(sizeof(struct _dw_unix_event)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6924 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6925 if(!eve) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6926 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6927 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6928 /* We need to be careful here, mutexes on Linux are |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6929 * FAST by default but are error checking on other |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6930 * systems such as FreeBSD and OS/2, perhaps others. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6931 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6932 pthread_mutex_init (&(eve->mutex), NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6933 pthread_mutex_lock (&(eve->mutex)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6934 pthread_cond_init (&(eve->event), NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6935 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6936 pthread_mutex_unlock (&(eve->mutex)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6937 eve->alive = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6938 eve->posted = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6939 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6940 return eve; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6941 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6942 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6943 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6944 * Resets a semaphore created by dw_event_new(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6945 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6946 * eve: The handle to the event returned by dw_event_new(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6947 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6948 int dw_event_reset (HEV eve) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6949 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6950 if(!eve) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6951 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6952 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6953 pthread_mutex_lock (&(eve->mutex)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6954 pthread_cond_broadcast (&(eve->event)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6955 pthread_cond_init (&(eve->event), NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6956 eve->posted = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6957 pthread_mutex_unlock (&(eve->mutex)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6958 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6959 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6960 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6961 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6962 * Posts a semaphore created by dw_event_new(). Causing all threads |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6963 * waiting on this event in dw_event_wait to continue. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6964 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6965 * eve: The handle to the event returned by dw_event_new(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6966 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6967 int dw_event_post (HEV eve) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6968 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6969 if(!eve) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6970 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6971 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6972 pthread_mutex_lock (&(eve->mutex)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6973 pthread_cond_broadcast (&(eve->event)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6974 eve->posted = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6975 pthread_mutex_unlock (&(eve->mutex)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6976 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6977 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6978 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6979 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6980 * Waits on a semaphore created by dw_event_new(), until the |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6981 * event gets posted or until the timeout expires. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6982 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6983 * eve: The handle to the event returned by dw_event_new(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6984 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6985 int dw_event_wait(HEV eve, unsigned long timeout) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6986 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6987 int rc; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6988 struct timeval now; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6989 struct timespec timeo; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6990 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6991 if(!eve) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6992 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6993 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6994 if(eve->posted) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6995 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6996 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6997 pthread_mutex_lock (&(eve->mutex)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6998 gettimeofday(&now, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6999 timeo.tv_sec = now.tv_sec + (timeout / 1000); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7000 timeo.tv_nsec = now.tv_usec * 1000; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7001 rc = pthread_cond_timedwait (&(eve->event), &(eve->mutex), &timeo); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7002 pthread_mutex_unlock (&(eve->mutex)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7003 if(!rc) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7004 return 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7005 if(rc == ETIMEDOUT) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7006 return -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7007 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7008 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7009 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7010 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7011 * Closes a semaphore created by dw_event_new(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7012 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7013 * eve: The handle to the event returned by dw_event_new(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7014 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7015 int dw_event_close(HEV *eve) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7016 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7017 if(!eve || !(*eve)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7018 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7019 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7020 pthread_mutex_lock (&((*eve)->mutex)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7021 pthread_cond_destroy (&((*eve)->event)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7022 pthread_mutex_unlock (&((*eve)->mutex)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7023 pthread_mutex_destroy (&((*eve)->mutex)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7024 free(*eve); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7025 *eve = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7026 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7027 return TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7028 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7029 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7030 struct _seminfo { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7031 int fd; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7032 int waiting; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7033 }; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7034 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7035 static void _handle_sem(int *tmpsock) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7036 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7037 fd_set rd; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7038 struct _seminfo *array = (struct _seminfo *)malloc(sizeof(struct _seminfo)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7039 int listenfd = tmpsock[0]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7040 int bytesread, connectcount = 1, maxfd, z, posted = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7041 char command; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7042 sigset_t mask; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7043 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7044 sigfillset(&mask); /* Mask all allowed signals */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7045 pthread_sigmask(SIG_BLOCK, &mask, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7046 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7047 /* problems */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7048 if(tmpsock[1] == -1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7049 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7050 free(array); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7051 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7052 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7053 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7054 array[0].fd = tmpsock[1]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7055 array[0].waiting = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7056 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7057 /* Free the memory allocated in dw_named_event_new. */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7058 free(tmpsock); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7059 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7060 while(1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7061 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7062 FD_ZERO(&rd); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7063 FD_SET(listenfd, &rd); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7064 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7065 maxfd = listenfd; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7066 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7067 /* Added any connections to the named event semaphore */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7068 for(z=0;z<connectcount;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7069 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7070 if(array[z].fd > maxfd) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7071 maxfd = array[z].fd; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7072 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7073 FD_SET(array[z].fd, &rd); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7074 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7075 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7076 if(select(maxfd+1, &rd, NULL, NULL, NULL) == -1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7077 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7078 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7079 if(FD_ISSET(listenfd, &rd)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7080 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7081 struct _seminfo *newarray; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7082 int newfd = accept(listenfd, 0, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7083 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7084 if(newfd > -1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7085 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7086 /* Add new connections to the set */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7087 newarray = (struct _seminfo *)malloc(sizeof(struct _seminfo)*(connectcount+1)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7088 memcpy(newarray, array, sizeof(struct _seminfo)*(connectcount)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7089 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7090 newarray[connectcount].fd = newfd; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7091 newarray[connectcount].waiting = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7092 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7093 connectcount++; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7094 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7095 /* Replace old array with new one */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7096 free(array); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7097 array = newarray; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7098 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7099 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7100 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7101 /* Handle any events posted to the semaphore */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7102 for(z=0;z<connectcount;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7103 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7104 if(FD_ISSET(array[z].fd, &rd)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7105 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7106 if((bytesread = read(array[z].fd, &command, 1)) < 1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7107 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7108 struct _seminfo *newarray; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7109 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7110 /* Remove this connection from the set */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7111 newarray = (struct _seminfo *)malloc(sizeof(struct _seminfo)*(connectcount-1)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7112 if(!z) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7113 memcpy(newarray, &array[1], sizeof(struct _seminfo)*(connectcount-1)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7114 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7115 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7116 memcpy(newarray, array, sizeof(struct _seminfo)*z); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7117 if(z!=(connectcount-1)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7118 memcpy(&newarray[z], &array[z+1], sizeof(struct _seminfo)*(z-connectcount-1)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7119 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7120 connectcount--; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7121 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7122 /* Replace old array with new one */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7123 free(array); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7124 array = newarray; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7125 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7126 else if(bytesread == 1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7127 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7128 switch(command) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7129 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7130 case 0: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7131 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7132 /* Reset */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7133 posted = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7134 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7135 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7136 case 1: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7137 /* Post */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7138 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7139 int s; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7140 char tmp = (char)0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7141 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7142 posted = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7143 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7144 for(s=0;s<connectcount;s++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7145 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7146 /* The semaphore has been posted so |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7147 * we tell all the waiting threads to |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7148 * continue. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7149 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7150 if(array[s].waiting) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7151 write(array[s].fd, &tmp, 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7152 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7153 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7154 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7155 case 2: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7156 /* Wait */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7157 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7158 char tmp = (char)0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7159 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7160 array[z].waiting = 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7161 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7162 /* If we are posted exit immeditately */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7163 if(posted) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7164 write(array[z].fd, &tmp, 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7165 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7166 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7167 case 3: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7168 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7169 /* Done Waiting */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7170 array[z].waiting = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7171 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7172 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7173 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7174 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7175 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7176 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7177 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7178 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7179 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7180 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7181 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7182 /* Using domain sockets on unix for IPC */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7183 /* Create a named event semaphore which can be |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7184 * opened from other processes. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7185 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7186 * eve: Pointer to an event handle to receive handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7187 * name: Name given to semaphore which can be opened |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7188 * by other processes. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7189 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7190 HEV dw_named_event_new(char *name) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7191 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7192 struct sockaddr_un un; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7193 int ev, *tmpsock = (int *)malloc(sizeof(int)*2); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7194 DWTID dwthread; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7195 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7196 if(!tmpsock) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7197 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7198 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7199 tmpsock[0] = socket(AF_UNIX, SOCK_STREAM, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7200 ev = socket(AF_UNIX, SOCK_STREAM, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7201 memset(&un, 0, sizeof(un)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7202 un.sun_family=AF_UNIX; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7203 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7204 strcpy(un.sun_path, "/tmp/.dw/"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7205 strcat(un.sun_path, name); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7206 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7207 /* just to be safe, this should be changed |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7208 * to support multiple instances. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7209 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7210 remove(un.sun_path); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7211 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7212 bind(tmpsock[0], (struct sockaddr *)&un, sizeof(un)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7213 listen(tmpsock[0], 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7214 connect(ev, (struct sockaddr *)&un, sizeof(un)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7215 tmpsock[1] = accept(tmpsock[0], 0, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7216 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7217 if(tmpsock[0] < 0 || tmpsock[1] < 0 || ev < 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7218 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7219 if(tmpsock[0] > -1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7220 close(tmpsock[0]); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7221 if(tmpsock[1] > -1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7222 close(tmpsock[1]); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7223 if(ev > -1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7224 close(ev); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7225 free(tmpsock); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7226 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7227 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7228 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7229 /* Create a thread to handle this event semaphore */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7230 pthread_create(&dwthread, NULL, (void *)_handle_sem, (void *)tmpsock); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7231 return (HEV)ev; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7232 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7233 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7234 /* Open an already existing named event semaphore. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7235 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7236 * eve: Pointer to an event handle to receive handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7237 * name: Name given to semaphore which can be opened |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7238 * by other processes. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7239 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7240 HEV dw_named_event_get(char *name) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7241 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7242 struct sockaddr_un un; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7243 int ev = socket(AF_UNIX, SOCK_STREAM, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7244 if(ev < 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7245 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7246 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7247 un.sun_family=AF_UNIX; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7248 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7249 strcpy(un.sun_path, "/tmp/.dw/"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7250 strcat(un.sun_path, name); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7251 connect(ev, (struct sockaddr *)&un, sizeof(un)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7252 return (HEV)ev; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7253 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7254 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7255 /* Resets the event semaphore so threads who call wait |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7256 * on this semaphore will block. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7257 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7258 * eve: Handle to the semaphore obtained by |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7259 * an open or create call. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7260 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7261 int dw_named_event_reset(HEV eve) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7262 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7263 /* signal reset */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7264 char tmp = (char)0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7265 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7266 if((int)eve < 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7267 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7268 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7269 if(write((int)eve, &tmp, 1) == 1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7270 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7271 return 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7272 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7273 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7274 /* Sets the posted state of an event semaphore, any threads |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7275 * waiting on the semaphore will no longer block. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7276 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7277 * eve: Handle to the semaphore obtained by |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7278 * an open or create call. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7279 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7280 int dw_named_event_post(HEV eve) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7281 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7282 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7283 /* signal post */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7284 char tmp = (char)1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7285 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7286 if((int)eve < 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7287 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7288 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7289 if(write((int)eve, &tmp, 1) == 1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7290 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7291 return 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7292 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7293 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7294 /* Waits on the specified semaphore until it becomes |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7295 * posted, or returns immediately if it already is posted. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7296 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7297 * eve: Handle to the semaphore obtained by |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7298 * an open or create call. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7299 * timeout: Number of milliseconds before timing out |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7300 * or -1 if indefinite. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7301 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7302 int dw_named_event_wait(HEV eve, unsigned long timeout) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7303 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7304 fd_set rd; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7305 struct timeval tv, *useme; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7306 int retval = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7307 char tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7308 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7309 if((int)eve < 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7310 return DW_ERROR_NON_INIT; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7311 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7312 /* Set the timout or infinite */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7313 if(timeout == -1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7314 useme = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7315 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7316 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7317 tv.tv_sec = timeout / 1000; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7318 tv.tv_usec = timeout % 1000; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7319 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7320 useme = &tv; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7321 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7322 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7323 FD_ZERO(&rd); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7324 FD_SET((int)eve, &rd); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7325 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7326 /* Signal wait */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7327 tmp = (char)2; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7328 write((int)eve, &tmp, 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7329 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7330 retval = select((int)eve+1, &rd, NULL, NULL, useme); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7331 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7332 /* Signal done waiting. */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7333 tmp = (char)3; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7334 write((int)eve, &tmp, 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7335 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7336 if(retval == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7337 return DW_ERROR_TIMEOUT; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7338 else if(retval == -1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7339 return DW_ERROR_INTERRUPT; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7340 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7341 /* Clear the entry from the pipe so |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7342 * we don't loop endlessly. :) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7343 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7344 read((int)eve, &tmp, 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7345 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7346 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7347 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7348 /* Release this semaphore, if there are no more open |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7349 * handles on this semaphore the semaphore will be destroyed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7350 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7351 * eve: Handle to the semaphore obtained by |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7352 * an open or create call. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7353 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7354 int dw_named_event_close(HEV eve) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7355 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7356 /* Finally close the domain socket, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7357 * cleanup will continue in _handle_sem. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7358 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7359 close((int)eve); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7360 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7361 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7362 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7363 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7364 * Setup thread independent color sets. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7365 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7366 void _dwthreadstart(void *data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7367 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7368 void (*threadfunc)(void *) = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7369 void **tmp = (void **)data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7370 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7371 threadfunc = (void (*)(void *))tmp[0]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7372 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7373 _dw_thread_add(dw_thread_id()); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7374 threadfunc(tmp[1]); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7375 _dw_thread_remove(dw_thread_id()); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7376 free(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7377 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7378 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7379 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7380 * Allocates a shared memory region with a name. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7381 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7382 * handle: A pointer to receive a SHM identifier. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7383 * dest: A pointer to a pointer to receive the memory address. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7384 * size: Size in bytes of the shared memory region to allocate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7385 * name: A string pointer to a unique memory name. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7386 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7387 HSHM dw_named_memory_new(void **dest, int size, char *name) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7388 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7389 char namebuf[1024]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7390 struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7391 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7392 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7393 sprintf(namebuf, "/tmp/.dw/%s", name); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7394 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7395 if((handle->fd = open(namebuf, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR)) < 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7396 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7397 free(handle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7398 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7399 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7400 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7401 ftruncate(handle->fd, size); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7402 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7403 /* attach the shared memory segment to our process's address space. */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7404 *dest = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, handle->fd, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7405 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7406 if(*dest == MAP_FAILED) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7407 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7408 close(handle->fd); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7409 *dest = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7410 free(handle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7411 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7412 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7413 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7414 handle->size = size; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7415 handle->sid = getsid(0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7416 handle->path = strdup(namebuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7417 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7418 return handle; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7419 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7420 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7421 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7422 * Aquires shared memory region with a name. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7423 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7424 * dest: A pointer to a pointer to receive the memory address. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7425 * size: Size in bytes of the shared memory region to requested. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7426 * name: A string pointer to a unique memory name. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7427 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7428 HSHM dw_named_memory_get(void **dest, int size, char *name) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7429 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7430 char namebuf[1024]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7431 struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7432 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7433 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7434 sprintf(namebuf, "/tmp/.dw/%s", name); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7435 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7436 if((handle->fd = open(namebuf, O_RDWR)) < 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7437 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7438 free(handle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7439 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7440 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7441 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7442 /* attach the shared memory segment to our process's address space. */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7443 *dest = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, handle->fd, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7444 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7445 if(*dest == MAP_FAILED) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7446 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7447 close(handle->fd); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7448 *dest = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7449 free(handle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7450 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7451 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7452 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7453 handle->size = size; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7454 handle->sid = -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7455 handle->path = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7456 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7457 return handle; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7458 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7459 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7460 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7461 * Frees a shared memory region previously allocated. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7462 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7463 * handle: Handle obtained from DB_named_memory_allocate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7464 * ptr: The memory address aquired with DB_named_memory_allocate. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7465 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7466 int dw_named_memory_free(HSHM handle, void *ptr) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7467 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7468 struct _dw_unix_shm *h = handle; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7469 int rc = munmap(ptr, h->size); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7470 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7471 close(h->fd); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7472 if(h->path) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7473 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7474 /* Only remove the actual file if we are the |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7475 * creator of the file. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7476 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7477 if(h->sid != -1 && h->sid == getsid(0)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7478 remove(h->path); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7479 free(h->path); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7480 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7481 return rc; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7482 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7483 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7484 * Creates a new thread with a starting point of func. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7485 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7486 * func: Function which will be run in the new thread. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7487 * data: Parameter(s) passed to the function. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7488 * stack: Stack size of new thread (OS/2 and Windows only). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7489 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7490 DWTID dw_thread_new(void *func, void *data, int stack) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7491 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7492 DWTID gtkthread; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7493 void **tmp = malloc(sizeof(void *) * 2); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7494 int rc; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7495 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7496 tmp[0] = func; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7497 tmp[1] = data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7498 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7499 rc = pthread_create(>kthread, NULL, (void *)_dwthreadstart, (void *)tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7500 if ( rc == 0 ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7501 return gtkthread; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7502 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7503 return rc; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7504 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7505 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7506 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7507 * Ends execution of current thread immediately. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7508 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7509 void dw_thread_end(void) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7510 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7511 pthread_exit(NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7512 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7513 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7514 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7515 * Returns the current thread's ID. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7516 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7517 DWTID dw_thread_id(void) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7518 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7519 return (DWTID)pthread_self(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7520 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7521 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7522 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7523 * Cleanly terminates a DW session, should be signal handler safe. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7524 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7525 * exitcode: Exit code reported to the operating system. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7526 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7527 void dw_exit(int exitcode) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7528 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7529 if ( dbgfp != NULL ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7530 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7531 fclose( dbgfp ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7532 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7533 exit(exitcode); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7534 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7535 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7536 #define DW_EXPAND (GTK_EXPAND | GTK_SHRINK | GTK_FILL) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7537 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7538 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7539 * Pack windows (widgets) into a box from the end (or bottom). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7540 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7541 * box: Window handle of the box to be packed into. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7542 * item: Window handle of the item to be back. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7543 * width: Width in pixels of the item or -1 to be self determined. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7544 * height: Height in pixels of the item or -1 to be self determined. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7545 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7546 * vsize: TRUE if the window (widget) should expand vertically to fill space given. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7547 * pad: Number of pixels of padding around the item. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7548 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7549 void dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7550 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7551 int warn = FALSE, _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7552 GtkWidget *tmp, *tmpitem; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7553 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7554 if(!box) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7555 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7556 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7557 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7558 * If you try and pack an item into itself VERY bad things can happen; like at least an |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7559 * infinite loop on GTK! Lets be safe! |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7560 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7561 if(box == item) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7562 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7563 dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7564 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7565 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7566 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7567 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7568 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7569 if((tmp = g_object_get_data(G_OBJECT(box), "_dw_boxhandle"))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7570 box = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7571 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7572 if(!item) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7573 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7574 item = gtk_label_new(""); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7575 gtk_widget_show_all(item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7576 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7577 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7578 tmpitem = (GtkWidget *)g_object_get_data(G_OBJECT(item), "_dw_boxhandle"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7579 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7580 if(GTK_IS_TABLE(box)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7581 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7582 int boxcount = (int)g_object_get_data(G_OBJECT(box), "_dw_boxcount"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7583 int boxtype = (int)g_object_get_data(G_OBJECT(box), "_dw_boxtype"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7584 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7585 /* If the item being packed is a box, then we use it's padding |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7586 * instead of the padding specified on the pack line, this is |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7587 * due to a bug in the OS/2 and Win32 renderer and a limitation |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7588 * of the GtkTable class. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7589 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7590 if(GTK_IS_TABLE(item) || (tmpitem && GTK_IS_TABLE(tmpitem))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7591 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7592 GtkWidget *eventbox = (GtkWidget *)g_object_get_data(G_OBJECT(item), "_dw_eventbox"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7593 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7594 /* NOTE: I left in the ability to pack boxes with a size, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7595 * this eliminates that by forcing the size to 0. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7596 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7597 height = width = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7598 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7599 if(eventbox) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7600 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7601 int boxpad = (int)g_object_get_data(G_OBJECT(item), "_dw_boxpad"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7602 gtk_container_add(GTK_CONTAINER(eventbox), item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7603 gtk_container_set_border_width(GTK_CONTAINER(eventbox), boxpad); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7604 item = eventbox; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7605 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7606 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7607 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7608 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7609 /* Only show warning if item is not a box */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7610 warn = TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7611 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7612 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7613 if(boxtype == DW_VERT) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7614 gtk_table_resize(GTK_TABLE(box), boxcount + 1, 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7615 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7616 gtk_table_resize(GTK_TABLE(box), 1, boxcount + 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7617 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7618 gtk_table_attach(GTK_TABLE(box), item, 0, 1, 0, 1, hsize ? DW_EXPAND : 0, vsize ? DW_EXPAND : 0, pad, pad); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7619 g_object_set_data(G_OBJECT(box), "_dw_boxcount", GINT_TO_POINTER(boxcount + 1)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7620 gtk_widget_set_size_request(item, width, height); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7621 if(GTK_IS_RADIO_BUTTON(item)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7622 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7623 GSList *group; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7624 GtkWidget *groupstart = (GtkWidget *)g_object_get_data(G_OBJECT(box), "_dw_group"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7625 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7626 if(groupstart) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7627 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7628 group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(groupstart)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7629 gtk_radio_button_set_group(GTK_RADIO_BUTTON(item), group); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7630 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7631 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7632 g_object_set_data(G_OBJECT(box), "_dw_group", (gpointer)item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7633 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7634 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7635 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7636 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7637 GtkWidget *vbox = gtk_vbox_new(FALSE, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7638 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7639 if(GTK_IS_TABLE(item) || (tmpitem && GTK_IS_TABLE(tmpitem))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7640 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7641 GtkWidget *eventbox = (GtkWidget *)g_object_get_data(G_OBJECT(item), "_dw_eventbox"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7642 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7643 /* NOTE: I left in the ability to pack boxes with a size, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7644 * this eliminates that by forcing the size to 0. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7645 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7646 height = width = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7647 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7648 if(eventbox) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7649 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7650 int boxpad = (int)g_object_get_data(G_OBJECT(item), "_dw_boxpad"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7651 gtk_container_add(GTK_CONTAINER(eventbox), item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7652 gtk_container_set_border_width(GTK_CONTAINER(eventbox), boxpad); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7653 item = eventbox; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7654 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7655 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7656 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7657 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7658 /* Only show warning if item is not a box */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7659 warn = TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7660 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7661 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7662 gtk_container_set_border_width(GTK_CONTAINER(box), pad); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7663 gtk_container_add(GTK_CONTAINER(box), vbox); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7664 gtk_box_pack_end(GTK_BOX(vbox), item, TRUE, TRUE, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7665 gtk_widget_show(vbox); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7666 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7667 gtk_widget_set_size_request(item, width, height); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7668 g_object_set_data(G_OBJECT(box), "_dw_user", vbox); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7669 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7670 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7671 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7672 if(warn) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7673 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7674 if ( width == 0 && hsize == FALSE ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7675 dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7676 if ( height == 0 && vsize == FALSE ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7677 dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7678 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7679 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7680 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7681 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7682 * Sets the size of a given window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7683 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7684 * handle: Window (widget) handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7685 * width: New width in pixels. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7686 * height: New height in pixels. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7687 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7688 void dw_window_set_size(HWND handle, unsigned long width, unsigned long height) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7689 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7690 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7691 long default_width = width - _dw_border_width; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7692 long default_height = height - _dw_border_height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7693 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7694 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7695 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7696 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7697 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7698 if(GTK_IS_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7699 { |
777
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
7700 GdkGeometry hints; |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
7701 |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7702 if ( width == 0 ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7703 default_width = -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7704 if ( height == 0 ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7705 default_height = -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7706 |
777
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
7707 hints.base_width = hints.base_height = 1; |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
7708 hints.min_width = hints.min_height = 8; |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
7709 hints.width_inc = hints.height_inc = 1; |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
7710 |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
7711 gtk_window_set_geometry_hints(GTK_WINDOW(handle), NULL, &hints, GDK_HINT_RESIZE_INC|GDK_HINT_MIN_SIZE|GDK_HINT_BASE_SIZE); |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
7712 |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7713 if(gtk_widget_get_window(handle) && default_width > 0 && default_height > 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7714 gdk_window_resize(gtk_widget_get_window(handle), default_width , default_height ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7715 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7716 gtk_window_set_default_size(GTK_WINDOW(handle), default_width , default_height ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7717 if(!g_object_get_data(G_OBJECT(handle), "_dw_size")) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7718 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7719 g_object_set_data(G_OBJECT(handle), "_dw_width", GINT_TO_POINTER(default_width) ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7720 g_object_set_data(G_OBJECT(handle), "_dw_height", GINT_TO_POINTER(default_height) ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7721 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7722 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7723 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7724 gtk_widget_set_size_request(handle, width, height); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7725 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7726 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7727 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7728 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7729 * Returns the width of the screen. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7730 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7731 int dw_screen_width(void) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7732 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7733 int retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7734 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7735 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7736 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7737 retval = gdk_screen_width(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7738 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7739 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7740 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7741 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7742 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7743 * Returns the height of the screen. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7744 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7745 int dw_screen_height(void) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7746 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7747 int retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7748 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7749 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7750 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7751 retval = gdk_screen_height(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7752 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7753 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7754 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7755 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7756 /* This should return the current color depth */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7757 unsigned long dw_color_depth_get(void) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7758 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7759 int retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7760 GdkVisual *vis; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7761 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7762 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7763 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7764 vis = gdk_visual_get_system(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7765 retval = gdk_visual_get_depth(vis); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7766 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7767 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7768 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7769 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7770 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7771 * Sets the position of a given window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7772 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7773 * handle: Window (widget) handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7774 * x: X location from the bottom left. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7775 * y: Y location from the bottom left. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7776 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7777 void dw_window_set_pos(HWND handle, long x, long y) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7778 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7779 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7780 GtkWidget *mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7781 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7782 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7783 if((mdi = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_mdi")) && GTK_IS_MDI(mdi)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7784 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7785 gtk_mdi_move(GTK_MDI(mdi), handle, x, y); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7786 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7787 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7788 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7789 if(handle && gtk_widget_get_window(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7790 gdk_window_move(gtk_widget_get_window(handle), x, y); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7791 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7792 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7793 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7794 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7795 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7796 * Sets the position and size of a given window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7797 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7798 * handle: Window (widget) handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7799 * x: X location from the bottom left. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7800 * y: Y location from the bottom left. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7801 * width: Width of the widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7802 * height: Height of the widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7803 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7804 void dw_window_set_pos_size(HWND handle, long x, long y, unsigned long width, unsigned long height) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7805 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7806 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7807 GtkWidget *mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7808 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7809 if(!handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7810 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7811 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7812 if((mdi = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_mdi")) && GTK_IS_MDI(mdi)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7813 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7814 gtk_mdi_move(GTK_MDI(mdi), handle, x, y); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7815 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7816 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7817 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7818 if(GTK_IS_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7819 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7820 dw_window_set_size(handle, width, height); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7821 #if 0 /* TODO: Deprecated with no replaced... what to do here? */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7822 gtk_widget_set_uposition(handle, x, y); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7823 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7824 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7825 else if(gtk_widget_get_window(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7826 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7827 gdk_window_resize(gtk_widget_get_window(handle), width, height); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7828 gdk_window_move(gtk_widget_get_window(handle), x, y); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7829 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7830 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7831 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7832 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7833 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7834 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7835 * Gets the position and size of a given window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7836 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7837 * handle: Window (widget) handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7838 * x: X location from the bottom left. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7839 * y: Y location from the bottom left. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7840 * width: Width of the widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7841 * height: Height of the widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7842 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7843 void dw_window_get_pos_size(HWND handle, long *x, long *y, ULONG *width, ULONG *height) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7844 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7845 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7846 gint gx, gy, gwidth, gheight; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7847 GtkWidget *mdi; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7848 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7849 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7850 if((mdi = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_mdi")) && GTK_IS_MDI(mdi)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7851 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7852 gint myx=0, myy=0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7853 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7854 gtk_mdi_get_pos(GTK_MDI(mdi), handle, &myx, &myy); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7855 *x = myx; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7856 *y = myy; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7857 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7858 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7859 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7860 if(handle && gtk_widget_get_window(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7861 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7862 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7863 gdk_window_get_geometry(gtk_widget_get_window(handle), &gx, &gy, &gwidth, &gheight); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7864 gdk_window_get_root_origin(gtk_widget_get_window(handle), &gx, &gy); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7865 if(x) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7866 *x = gx; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7867 if(y) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7868 *y = gy; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7869 if(GTK_IS_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7870 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7871 if(width) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7872 *width = gwidth + _dw_border_width; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7873 if(height) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7874 *height = gheight + _dw_border_height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7875 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7876 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7877 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7878 if(width) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7879 *width = gwidth; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7880 if(height) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7881 *height = gheight; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7882 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7883 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7884 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7885 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7886 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7887 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7888 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7889 * Sets the style of a given window (widget). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7890 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7891 * handle: Window (widget) handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7892 * width: New width in pixels. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7893 * height: New height in pixels. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7894 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7895 void dw_window_set_style(HWND handle, unsigned long style, unsigned long mask) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7896 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7897 GtkWidget *handle2 = handle; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7898 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7899 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7900 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7901 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7902 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7903 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7904 if(tmp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7905 handle2 = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7906 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7907 else if(GTK_IS_FRAME(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7908 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7909 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_label"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7910 if(tmp && GTK_IS_LABEL(tmp)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7911 handle2 = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7912 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7913 else if(GTK_IS_BUTTON(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7914 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7915 if(mask & DW_BS_NOBORDER) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7916 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7917 if(style & DW_BS_NOBORDER) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7918 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7919 gtk_button_set_relief((GtkButton *)handle, GTK_RELIEF_NONE); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7920 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7921 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7922 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7923 gtk_button_set_relief((GtkButton *)handle, GTK_RELIEF_NORMAL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7924 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7925 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7926 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7927 if ( GTK_IS_LABEL(handle2) ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7928 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7929 gfloat x=DW_LEFT, y=DW_CENTER; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7930 /* horizontal... */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7931 if ( style & DW_DT_CENTER ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7932 x = DW_CENTER; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7933 if ( style & DW_DT_RIGHT ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7934 x = DW_RIGHT; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7935 if ( style & DW_DT_LEFT ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7936 x = DW_LEFT; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7937 /* vertical... */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7938 if ( style & DW_DT_VCENTER ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7939 y = DW_CENTER; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7940 if ( style & DW_DT_TOP ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7941 y = DW_TOP; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7942 if ( style & DW_DT_BOTTOM ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7943 y = DW_BOTTOM; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7944 gtk_misc_set_alignment( GTK_MISC(handle2), x, y ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7945 if ( style & DW_DT_WORDBREAK ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7946 gtk_label_set_line_wrap( GTK_LABEL(handle), TRUE ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7947 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7948 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7949 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7950 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7951 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7952 * Adds a new page to specified notebook. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7953 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7954 * handle: Window (widget) handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7955 * flags: Any additional page creation flags. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7956 * front: If TRUE page is added at the beginning. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7957 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7958 unsigned long dw_notebook_page_new(HWND handle, unsigned long flags, int front) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7959 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7960 int z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7961 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7962 GtkWidget **pagearray; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7963 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7964 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7965 pagearray = (GtkWidget **)g_object_get_data(G_OBJECT(handle), "_dw_pagearray"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7966 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7967 if(pagearray) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7968 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7969 for(z=0;z<256;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7970 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7971 if(!pagearray[z]) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7972 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7973 char text[100]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7974 int num = z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7975 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7976 if(front) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7977 num |= 1 << 16; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7978 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7979 sprintf(text, "_dw_page%d", z); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7980 /* Save the real id and the creation flags */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7981 g_object_set_data(G_OBJECT(handle), text, GINT_TO_POINTER(num)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7982 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7983 return z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7984 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7985 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7986 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7987 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7988 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7989 /* Hopefully this won't happen. */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7990 return 256; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7991 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7992 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7993 /* Return the physical page id from the logical page id */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7994 int _get_physical_page(HWND handle, unsigned long pageid) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7995 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7996 int z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7997 GtkWidget *thispage, **pagearray = g_object_get_data(G_OBJECT(handle), "_dw_pagearray"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7998 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7999 if(pagearray) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8000 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8001 for(z=0;z<256;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8002 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8003 if((thispage = gtk_notebook_get_nth_page(GTK_NOTEBOOK(handle), z))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8004 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8005 if(thispage == pagearray[pageid]) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8006 return z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8007 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8008 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8009 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8010 return 256; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8011 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8012 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8013 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8014 * Remove a page from a notebook. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8015 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8016 * handle: Handle to the notebook widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8017 * pageid: ID of the page to be destroyed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8018 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8019 void dw_notebook_page_destroy(HWND handle, unsigned int pageid) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8020 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8021 int realpage, _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8022 GtkWidget **pagearray; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8023 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8024 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8025 realpage = _get_physical_page(handle, pageid); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8026 if(realpage > -1 && realpage < 256) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8027 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8028 gtk_notebook_remove_page(GTK_NOTEBOOK(handle), realpage); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8029 if((pagearray = g_object_get_data(G_OBJECT(handle), "_dw_pagearray"))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8030 pagearray[pageid] = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8031 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8032 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8033 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8034 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8035 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8036 * Queries the currently visible page ID. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8037 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8038 * handle: Handle to the notebook widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8039 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8040 unsigned long dw_notebook_page_get(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8041 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8042 int retval, phys; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8043 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8044 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8045 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8046 phys = gtk_notebook_get_current_page(GTK_NOTEBOOK(handle)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8047 retval = _get_logical_page(handle, phys); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8048 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8049 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8050 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8051 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8052 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8053 * Sets the currently visibale page ID. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8054 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8055 * handle: Handle to the notebook widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8056 * pageid: ID of the page to be made visible. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8057 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8058 void dw_notebook_page_set(HWND handle, unsigned int pageid) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8059 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8060 int realpage, _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8061 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8062 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8063 realpage = _get_physical_page(handle, pageid); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8064 if(realpage > -1 && realpage < 256) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8065 gtk_notebook_set_current_page(GTK_NOTEBOOK(handle), pageid); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8066 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8067 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8068 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8069 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8070 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8071 * Sets the text on the specified notebook tab. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8072 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8073 * handle: Notebook handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8074 * pageid: Page ID of the tab to set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8075 * text: Pointer to the text to set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8076 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8077 void dw_notebook_page_set_text(HWND handle, unsigned long pageid, char *text) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8078 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8079 GtkWidget *child; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8080 int realpage, _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8081 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8082 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8083 realpage = _get_physical_page(handle, pageid); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8084 if(realpage < 0 || realpage > 255) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8085 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8086 char ptext[100]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8087 int num; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8088 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8089 sprintf(ptext, "_dw_page%d", (int)pageid); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8090 num = (int)g_object_get_data(G_OBJECT(handle), ptext); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8091 realpage = 0xFF & num; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8092 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8093 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8094 if(realpage > -1 && realpage < 256) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8095 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8096 child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(handle), realpage); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8097 if(child) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8098 gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(handle), child, text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8099 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8100 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8101 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8102 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8103 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8104 * Sets the text on the specified notebook tab status area. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8105 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8106 * handle: Notebook handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8107 * pageid: Page ID of the tab to set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8108 * text: Pointer to the text to set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8109 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8110 void dw_notebook_page_set_status_text(HWND handle, unsigned long pageid, char *text) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8111 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8112 /* TODO (if possible) */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8113 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8114 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8115 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8116 * Packs the specified box into the notebook page. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8117 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8118 * handle: Handle to the notebook to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8119 * pageid: Page ID in the notebook which is being packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8120 * page: Box handle to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8121 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8122 void dw_notebook_pack(HWND handle, unsigned long pageid, HWND page) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8123 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8124 GtkWidget *label, *child, *oldlabel, **pagearray; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8125 gchar *text = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8126 int num, z, realpage = -1, pad, _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8127 char ptext[100]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8128 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8129 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8130 sprintf(ptext, "_dw_page%d", (int)pageid); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8131 num = (int)g_object_get_data(G_OBJECT(handle), ptext); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8132 g_object_set_data(G_OBJECT(handle), ptext, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8133 pagearray = (GtkWidget **)g_object_get_data(G_OBJECT(handle), "_dw_pagearray"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8134 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8135 if(!pagearray) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8136 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8137 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8138 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8139 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8140 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8141 /* The page already exists... so get it's current page */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8142 if(pagearray[pageid]) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8143 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8144 for(z=0;z<256;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8145 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8146 child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(handle), z); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8147 if(child == pagearray[pageid]) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8148 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8149 oldlabel = gtk_notebook_get_tab_label(GTK_NOTEBOOK(handle), child); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8150 #if 0 /* TODO: gtk_label_get is deprecated with no replacement */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8151 if(oldlabel) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8152 gtk_label_get(GTK_LABEL(oldlabel), &text); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8153 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8154 gtk_notebook_remove_page(GTK_NOTEBOOK(handle), z); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8155 realpage = z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8156 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8157 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8158 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8159 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8160 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8161 pagearray[pageid] = page; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8162 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8163 label = gtk_label_new(text ? text : ""); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8164 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8165 if(GTK_IS_TABLE(page)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8166 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8167 pad = (int)g_object_get_data(G_OBJECT(page), "_dw_boxpad"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8168 gtk_container_set_border_width(GTK_CONTAINER(page), pad); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8169 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8170 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8171 if(realpage != -1) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8172 gtk_notebook_insert_page(GTK_NOTEBOOK(handle), page, label, realpage); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8173 else if(num & ~(0xFF)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8174 gtk_notebook_insert_page(GTK_NOTEBOOK(handle), page, label, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8175 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8176 gtk_notebook_insert_page(GTK_NOTEBOOK(handle), page, label, 256); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8177 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8178 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8179 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8180 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8181 * Appends the specified text to the listbox's (or combobox) entry list. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8182 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8183 * handle: Handle to the listbox to be appended to. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8184 * text: Text to append into listbox. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8185 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8186 void dw_listbox_append(HWND handle, char *text) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8187 { |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8188 dw_listbox_insert(handle, text, -1); |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8189 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8190 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8191 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8192 * Inserts the specified text int the listbox's (or combobox) entry list at the |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8193 * position indicated. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8194 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8195 * handle: Handle to the listbox to be appended to. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8196 * text: Text to insert into listbox. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8197 * pos: 0-based index into listbox. -1 will append |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8198 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8199 void dw_listbox_insert(HWND handle, char *text, int pos) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8200 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8201 GtkWidget *handle2 = handle; |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8202 GtkListStore *store = NULL; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8203 int _locked_by_me = FALSE; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8204 |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8205 DW_MUTEX_LOCK; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8206 /* Get the inner handle for scrolled controls */ |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8207 if(GTK_IS_SCROLLED_WINDOW(handle)) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8208 { |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8209 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8210 if(tmp) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8211 handle2 = tmp; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8212 } |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8213 if(handle2) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8214 { |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8215 GtkTreeIter iter; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8216 |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8217 /* Make sure it is the correct tree type */ |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8218 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8219 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8220 else if(GTK_IS_COMBO_BOX(handle2)) |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8221 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8222 |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8223 if(!store) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8224 { |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8225 DW_MUTEX_UNLOCK; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8226 return; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8227 } |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8228 |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8229 if(pos < 0) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8230 { |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8231 /* Insert an entry at the end */ |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8232 gtk_list_store_append(store, &iter); |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8233 } |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8234 else |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8235 { |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8236 /* Insert at position */ |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8237 gtk_list_store_insert(store, &iter, pos); |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8238 } |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8239 gtk_list_store_set (store, &iter, 0, text, -1); |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8240 } |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8241 DW_MUTEX_UNLOCK; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8242 } |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8243 |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8244 /* |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8245 * Appends the specified text items to the listbox's (or combobox) entry list. |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8246 * Parameters: |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8247 * handle: Handle to the listbox to be appended to. |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8248 * text: Text strings to append into listbox. |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8249 * count: Number of text strings to append |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8250 */ |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8251 void dw_listbox_list_append(HWND handle, char **text, int count) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8252 { |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8253 GtkWidget *handle2 = handle; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8254 GtkListStore *store = NULL; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8255 int _locked_by_me = FALSE; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8256 |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8257 DW_MUTEX_LOCK; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8258 /* Get the inner handle for scrolled controls */ |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8259 if(GTK_IS_SCROLLED_WINDOW(handle)) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8260 { |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8261 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8262 if(tmp) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8263 handle2 = tmp; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8264 } |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8265 if(handle2) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8266 { |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8267 int z; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8268 GtkTreeIter iter; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8269 |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8270 /* Make sure it is the correct tree type */ |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8271 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8272 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8273 else if(GTK_IS_COMBO_BOX(handle2)) |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8274 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8275 |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8276 if(!store) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8277 { |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8278 DW_MUTEX_UNLOCK; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8279 return; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8280 } |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8281 |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8282 /* Insert entries at the end */ |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8283 for(z=0;z<count;z++) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8284 { |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8285 gtk_list_store_append(store, &iter); |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8286 gtk_list_store_set (store, &iter, 0, text[z], -1); |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8287 } |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8288 } |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8289 DW_MUTEX_UNLOCK; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8290 } |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8291 |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8292 /* |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8293 * Clears the listbox's (or combobox) list of all entries. |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8294 * Parameters: |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8295 * handle: Handle to the listbox to be cleared. |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8296 */ |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8297 void dw_listbox_clear(HWND handle) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8298 { |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8299 GtkWidget *handle2 = handle; |
777
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
8300 GtkListStore *store = NULL; |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
8301 int _locked_by_me = FALSE; |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
8302 |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
8303 DW_MUTEX_LOCK; |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
8304 /* Get the inner handle for scrolled controls */ |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8305 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8306 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8307 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8308 if(tmp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8309 handle2 = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8310 } |
777
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
8311 if(handle2) |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
8312 { |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
8313 /* Make sure it is the correct tree type */ |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8314 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8315 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
777
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
8316 else if(GTK_IS_COMBO_BOX(handle2)) |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8317 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
777
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
8318 |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
8319 if(!store) |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
8320 { |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
8321 DW_MUTEX_UNLOCK; |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
8322 return; |
c0e7200dad31
More work on comboboxes, listboxes and containers. Comboboxes now display the list properly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
775
diff
changeset
|
8323 } |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8324 /* Clear the list */ |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8325 gtk_list_store_clear(store); |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8326 } |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8327 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8328 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8329 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8330 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8331 * Returns the listbox's item count. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8332 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8333 * handle: Handle to the listbox to be counted |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8334 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8335 int dw_listbox_count(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8336 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8337 GtkWidget *handle2 = handle; |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8338 GtkListStore *store = NULL; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8339 int _locked_by_me = FALSE; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8340 int retval = 0; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8341 |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8342 DW_MUTEX_LOCK; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8343 /* Get the inner handle for scrolled controls */ |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8344 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8345 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8346 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8347 if(tmp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8348 handle2 = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8349 } |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8350 if(handle2) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8351 { |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8352 /* Make sure it is the correct tree type */ |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8353 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8354 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8355 else if(GTK_IS_COMBO_BOX(handle2)) |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8356 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8357 |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8358 if(store) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8359 { |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8360 /* Get the number of children at the top level */ |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8361 retval = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8362 } |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8363 } |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8364 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8365 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8366 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8367 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8368 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8369 * Sets the topmost item in the viewport. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8370 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8371 * handle: Handle to the listbox to be cleared. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8372 * top: Index to the top item. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8373 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8374 void dw_listbox_set_top(HWND handle, int top) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8375 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8376 GtkWidget *handle2 = handle; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8377 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8378 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8379 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8380 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8381 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8382 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8383 if(tmp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8384 handle2 = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8385 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8386 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8387 if(GTK_IS_LIST(handle2)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8388 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8389 int count = dw_listbox_count(handle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8390 GtkAdjustment *adj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(handle)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8391 float pos, ratio; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8392 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8393 if(count) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8394 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8395 ratio = (float)top/(float)count; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8396 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8397 pos = (ratio * (float)(adj->upper - adj->lower)) + adj->lower; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8398 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8399 gtk_adjustment_set_value(adj, pos); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8400 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8401 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8402 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8403 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8404 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8405 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8406 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8407 * Copies the given index item's text into buffer. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8408 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8409 * handle: Handle to the listbox to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8410 * index: Index into the list to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8411 * buffer: Buffer where text will be copied. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8412 * length: Length of the buffer (including NULL). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8413 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8414 void dw_listbox_get_text(HWND handle, unsigned int index, char *buffer, unsigned int length) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8415 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8416 GtkWidget *handle2 = handle; |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8417 GtkListStore *store = NULL; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8418 int _locked_by_me = FALSE; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8419 |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8420 DW_MUTEX_LOCK; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8421 /* Get the inner handle for scrolled controls */ |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8422 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8423 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8424 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8425 if(tmp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8426 handle2 = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8427 } |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8428 if(handle2) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8429 { |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8430 /* Make sure it is the correct tree type */ |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8431 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8432 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8433 else if(GTK_IS_COMBO_BOX(handle2)) |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8434 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8435 |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8436 if(store && index < gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8437 { |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8438 GtkTreeIter iter; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8439 |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8440 /* Get the nth child at the top level */ |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8441 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8442 { |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8443 /* Get the text */ |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8444 gchar *text; |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8445 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &text, -1); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8446 strncpy(buffer, text, length); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8447 DW_MUTEX_UNLOCK; |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8448 return; |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8449 } |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8450 } |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8451 } |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8452 buffer[0] = '\0'; |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8453 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8454 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8455 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8456 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8457 * Sets the text of a given listbox entry. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8458 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8459 * handle: Handle to the listbox to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8460 * index: Index into the list to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8461 * buffer: Buffer where text will be copied. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8462 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8463 void dw_listbox_set_text(HWND handle, unsigned int index, char *buffer) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8464 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8465 GtkWidget *handle2 = handle; |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8466 GtkListStore *store = NULL; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8467 int _locked_by_me = FALSE; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8468 |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8469 DW_MUTEX_LOCK; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8470 /* Get the inner handle for scrolled controls */ |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8471 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8472 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8473 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8474 if(tmp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8475 handle2 = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8476 } |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8477 if(handle2) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8478 { |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8479 /* Make sure it is the correct tree type */ |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8480 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8481 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8482 else if(GTK_IS_COMBO_BOX(handle2)) |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8483 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8484 |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8485 if(store && index < gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8486 { |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8487 GtkTreeIter iter; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8488 |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8489 /* Get the nth child at the top level */ |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8490 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8491 { |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8492 /* Update the text */ |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8493 gtk_list_store_set(store, &iter, buffer); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8494 } |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8495 } |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8496 } |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8497 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8498 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8499 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8500 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8501 * Returns the index to the current selected item or -1 when done. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8502 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8503 * handle: Handle to the listbox to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8504 * where: Either the previous return or -1 to restart. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8505 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8506 int dw_listbox_selected_multi(HWND handle, int where) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8507 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8508 GtkWidget *handle2 = handle; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8509 int retval = DW_LIT_NONE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8510 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8511 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8512 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8513 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8514 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8515 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8516 if(tmp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8517 handle2 = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8518 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8519 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8520 if(GTK_IS_LIST(handle2)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8521 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8522 int counter = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8523 GList *list = GTK_LIST(handle2)->children; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8524 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8525 while(list) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8526 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8527 GtkItem *item = (GtkItem *)list->data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8528 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8529 if(item && |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8530 item->bin.container.widget.state == GTK_STATE_SELECTED |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8531 && counter > where) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8532 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8533 retval = counter; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8534 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8535 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8536 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8537 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8538 list = list->next; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8539 counter++; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8540 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8541 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8542 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8543 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8544 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8545 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8546 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8547 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8548 * Returns the index to the item in the list currently selected. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8549 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8550 * handle: Handle to the listbox to be queried. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8551 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8552 unsigned int dw_listbox_selected(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8553 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8554 GtkWidget *handle2 = handle; |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8555 GtkListStore *store = NULL; |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8556 int _locked_by_me = FALSE; |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8557 unsigned int retval = 0; |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8558 |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8559 DW_MUTEX_LOCK; |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8560 /* Get the inner handle for scrolled controls */ |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8561 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8562 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8563 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8564 if(tmp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8565 handle2 = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8566 } |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8567 if(handle2) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8568 { |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8569 /* Make sure it is the correct tree type */ |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8570 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8571 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8572 else if(GTK_IS_COMBO_BOX(handle2)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8573 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8574 |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8575 if(store) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8576 { |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8577 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(handle2)); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8578 GList *list = gtk_tree_selection_get_selected_rows(sel, NULL); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8579 if(list) |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8580 { |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8581 GtkTreePath *path = g_list_nth_data(list, 0); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8582 gint *indices = gtk_tree_path_get_indices(path); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8583 |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8584 if(indices) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8585 { |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8586 retval = indices[0]; |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8587 } |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8588 |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8589 g_list_foreach(list, (GFunc) gtk_tree_path_free, NULL); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8590 g_list_free(list); |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8591 } |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8592 } |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8593 } |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8594 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8595 return retval; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8596 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8597 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8598 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8599 * Sets the selection state of a given index. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8600 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8601 * handle: Handle to the listbox to be set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8602 * index: Item index. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8603 * state: TRUE if selected FALSE if unselected. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8604 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8605 void dw_listbox_select(HWND handle, int index, int state) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8606 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8607 GtkWidget *handle2 = handle; |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8608 GtkListStore *store = NULL; |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8609 int _locked_by_me = FALSE; |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8610 |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8611 DW_MUTEX_LOCK; |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8612 /* Get the inner handle for scrolled controls */ |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8613 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8614 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8615 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8616 if(tmp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8617 handle2 = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8618 } |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8619 if(handle2) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8620 { |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8621 /* Make sure it is the correct tree type */ |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8622 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8623 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8624 else if(GTK_IS_COMBO_BOX(handle2)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8625 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8626 |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8627 if(store && index < gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8628 { |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8629 GtkTreeIter iter; |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8630 |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8631 /* Get the nth child at the top level */ |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8632 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8633 { |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8634 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(handle2)); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8635 if(state) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8636 { |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8637 /* Select the item */ |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8638 gtk_tree_selection_select_iter(sel, &iter); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8639 } |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8640 else |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8641 { |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8642 /* Deselect the item */ |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8643 gtk_tree_selection_deselect_iter(sel, &iter); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8644 } |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8645 } |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8646 } |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8647 } |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8648 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8649 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8650 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8651 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8652 * Deletes the item with given index from the list. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8653 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8654 * handle: Handle to the listbox to be set. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8655 * index: Item index. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8656 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8657 void dw_listbox_delete(HWND handle, int index) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8658 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8659 GtkWidget *handle2 = handle; |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8660 GtkListStore *store = NULL; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8661 int _locked_by_me = FALSE; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8662 |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8663 DW_MUTEX_LOCK; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8664 /* Get the inner handle for scrolled controls */ |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8665 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8666 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8667 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8668 if(tmp) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8669 handle2 = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8670 } |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8671 if(handle2) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8672 { |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8673 /* Make sure it is the correct tree type */ |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8674 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == _DW_TREE_TYPE_LISTBOX) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8675 store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8676 else if(GTK_IS_COMBO_BOX(handle2)) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8677 store = (GtkTreeStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8678 |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8679 if(store) |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8680 { |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8681 GtkTreeIter iter; |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8682 |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8683 /* Get the nth child at the top level */ |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8684 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8685 { |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8686 gtk_list_store_remove(store, &iter); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
8687 } |
778
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8688 } |
99ce0ea1f271
Implemented many of the dw_listbox_* functions using the new tree view for comboboxes and listboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
777
diff
changeset
|
8689 } |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8690 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8691 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8692 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8693 /* Reposition the bar according to the percentage */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8694 static gint _splitbar_size_allocate(GtkWidget *widget, GtkAllocation *event, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8695 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8696 float *percent = (float *)g_object_get_data(G_OBJECT(widget), "_dw_percent"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8697 int lastwidth = (int)g_object_get_data(G_OBJECT(widget), "_dw_lastwidth"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8698 int lastheight = (int)g_object_get_data(G_OBJECT(widget), "_dw_lastheight"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8699 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8700 /* Prevent infinite recursion ;) */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8701 if(!percent || (lastwidth == event->width && lastheight == event->height)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8702 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8703 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8704 lastwidth = event->width; lastheight = event->height; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8705 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8706 g_object_set_data(G_OBJECT(widget), "_dw_lastwidth", GINT_TO_POINTER(lastwidth)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8707 g_object_set_data(G_OBJECT(widget), "_dw_lastheight", GINT_TO_POINTER(lastheight)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8708 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8709 if(GTK_IS_HPANED(widget)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8710 gtk_paned_set_position(GTK_PANED(widget), (int)(event->width * (*percent / 100.0))); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8711 if(GTK_IS_VPANED(widget)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8712 gtk_paned_set_position(GTK_PANED(widget), (int)(event->height * (*percent / 100.0))); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8713 g_object_set_data(G_OBJECT(widget), "_dw_waiting", NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8714 return FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8715 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8716 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8717 /* Figure out the new percentage */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8718 static void _splitbar_accept_position(GObject *object, GParamSpec *pspec, gpointer data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8719 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8720 GtkWidget *widget = (GtkWidget *)data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8721 float *percent = (float *)g_object_get_data(G_OBJECT(widget), "_dw_percent"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8722 int size = 0, position = gtk_paned_get_position(GTK_PANED(widget)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8723 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8724 if(!percent || g_object_get_data(G_OBJECT(widget), "_dw_waiting")) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8725 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8726 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8727 if(GTK_IS_VPANED(widget)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8728 size = gtk_widget_get_allocated_height(widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8729 else if(GTK_IS_HPANED(widget)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8730 size = gtk_widget_get_allocated_width(widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8731 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8732 if(size > 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8733 *percent = ((float)(position * 100) / (float)size); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8734 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8735 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8736 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8737 * Creates a splitbar window (widget) with given parameters. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8738 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8739 * type: Value can be DW_VERT or DW_HORZ. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8740 * topleft: Handle to the window to be top or left. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8741 * bottomright: Handle to the window to be bottom or right. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8742 * Returns: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8743 * A handle to a splitbar window or NULL on failure. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8744 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8745 HWND dw_splitbar_new(int type, HWND topleft, HWND bottomright, unsigned long id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8746 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8747 GtkWidget *tmp = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8748 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8749 float *percent = malloc(sizeof(float)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8750 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8751 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8752 if(type == DW_HORZ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8753 tmp = gtk_hpaned_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8754 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8755 tmp = gtk_vpaned_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8756 gtk_paned_add1(GTK_PANED(tmp), topleft); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8757 gtk_paned_add2(GTK_PANED(tmp), bottomright); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8758 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8759 *percent = 50.0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8760 g_object_set_data(G_OBJECT(tmp), "_dw_percent", (gpointer)percent); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8761 g_object_set_data(G_OBJECT(tmp), "_dw_waiting", GINT_TO_POINTER(1)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8762 g_signal_connect(G_OBJECT(tmp), "size-allocate", G_CALLBACK(_splitbar_size_allocate), NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8763 g_signal_connect(G_OBJECT(tmp), "notify::position", G_CALLBACK(_splitbar_accept_position), (gpointer)tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8764 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8765 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8766 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8767 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8768 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8769 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8770 * Sets the position of a splitbar (pecentage). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8771 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8772 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8773 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8774 void dw_splitbar_set(HWND handle, float percent) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8775 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8776 float *mypercent = (float *)dw_window_get_data(handle, "_dw_percent"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8777 int size = 0, position; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8778 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8779 if(GTK_IS_VPANED(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8780 size = gtk_widget_get_allocated_height(handle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8781 else if(GTK_IS_HPANED(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8782 size = gtk_widget_get_allocated_width(handle); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8783 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8784 if(mypercent) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8785 *mypercent = percent; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8786 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8787 if(size > 10) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8788 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8789 position = (int)((float)size * (percent / 100.0)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8790 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8791 gtk_paned_set_position(GTK_PANED(handle), position); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8792 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8793 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8794 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8795 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8796 * Gets the position of a splitbar (pecentage). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8797 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8798 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8799 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8800 float dw_splitbar_get(HWND handle) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8801 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8802 float *percent = (float *)dw_window_get_data(handle, "_dw_percent"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8803 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8804 if(percent) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8805 return *percent; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8806 return 0.0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8807 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8808 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8809 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8810 * Creates a calendar window (widget) with given parameters. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8811 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8812 * id: Unique identifier for calendar widget |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8813 * Returns: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8814 * A handle to a calendar window or NULL on failure. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8815 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8816 HWND dw_calendar_new(unsigned long id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8817 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8818 GtkWidget *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8819 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8820 GtkCalendarDisplayOptions flags; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8821 time_t now; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8822 struct tm *tmdata; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8823 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8824 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8825 tmp = gtk_calendar_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8826 gtk_widget_show(tmp); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8827 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8828 /* select today */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8829 flags = GTK_CALENDAR_SHOW_HEADING|GTK_CALENDAR_SHOW_DAY_NAMES; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8830 gtk_calendar_set_display_options( GTK_CALENDAR(tmp), flags ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8831 now = time( NULL ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8832 tmdata = localtime( & now ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8833 gtk_calendar_select_month( GTK_CALENDAR(tmp), tmdata->tm_mon, 1900+tmdata->tm_year ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8834 gtk_calendar_select_day( GTK_CALENDAR(tmp), tmdata->tm_mday ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8835 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8836 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8837 return tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8838 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8839 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8840 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8841 * Sets the current date of a calendar |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8842 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8843 * handle: The handle to the calendar returned by dw_calendar_new(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8844 * year... |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8845 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8846 void dw_calendar_set_date(HWND handle, unsigned int year, unsigned int month, unsigned int day) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8847 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8848 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8849 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8850 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8851 if(GTK_IS_CALENDAR(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8852 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8853 gtk_calendar_select_month(GTK_CALENDAR(handle),month-1,year); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8854 gtk_calendar_select_day(GTK_CALENDAR(handle), day); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8855 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8856 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8857 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8858 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8859 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8860 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8861 * Gets the position of a splitbar (pecentage). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8862 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8863 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8864 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8865 void dw_calendar_get_date(HWND handle, unsigned int *year, unsigned int *month, unsigned int *day) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8866 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8867 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8868 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8869 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8870 if(GTK_IS_CALENDAR(handle)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8871 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8872 gtk_calendar_get_date(GTK_CALENDAR(handle),year,month,day); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8873 *month = *month + 1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8874 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8875 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8876 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8877 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8878 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8879 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8880 * Pack windows (widgets) into a box from the start (or top). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8881 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8882 * box: Window handle of the box to be packed into. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8883 * item: Window handle of the item to be back. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8884 * width: Width in pixels of the item or -1 to be self determined. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8885 * height: Height in pixels of the item or -1 to be self determined. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8886 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8887 * vsize: TRUE if the window (widget) should expand vertically to fill space given. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8888 * pad: Number of pixels of padding around the item. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8889 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8890 void dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8891 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8892 int warn = FALSE, _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8893 GtkWidget *tmp, *tmpitem; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8894 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8895 if ( !box ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8896 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8897 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8898 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8899 * If you try and pack an item into itself VERY bad things can happen; like at least an |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8900 * infinite loop on GTK! Lets be safe! |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8901 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8902 if ( box == item ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8903 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8904 dw_messagebox( "dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8905 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8906 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8907 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8908 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8909 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8910 if ((tmp = g_object_get_data(G_OBJECT(box), "_dw_boxhandle"))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8911 box = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8912 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8913 if (!item) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8914 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8915 item = gtk_label_new(""); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8916 gtk_widget_show_all(item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8917 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8918 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8919 tmpitem = (GtkWidget *)g_object_get_data(G_OBJECT(item), "_dw_boxhandle"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8920 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8921 if (GTK_IS_TABLE(box)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8922 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8923 int boxcount = (int)g_object_get_data(G_OBJECT(box), "_dw_boxcount"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8924 int boxtype = (int)g_object_get_data(G_OBJECT(box), "_dw_boxtype"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8925 int x, y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8926 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8927 /* If the item being packed is a box, then we use it's padding |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8928 * instead of the padding specified on the pack line, this is |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8929 * due to a bug in the OS/2 and Win32 renderer and a limitation |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8930 * of the GtkTable class. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8931 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8932 if (GTK_IS_TABLE(item) || (tmpitem && GTK_IS_TABLE(tmpitem))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8933 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8934 GtkWidget *eventbox = (GtkWidget *)g_object_get_data(G_OBJECT(item), "_dw_eventbox"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8935 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8936 /* NOTE: I left in the ability to pack boxes with a size, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8937 * this eliminates that by forcing the size to 0. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8938 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8939 height = width = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8940 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8941 if (eventbox) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8942 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8943 int boxpad = (int)g_object_get_data(G_OBJECT(item), "_dw_boxpad"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8944 gtk_container_add(GTK_CONTAINER(eventbox), item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8945 gtk_container_set_border_width(GTK_CONTAINER(eventbox), boxpad); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8946 item = eventbox; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8947 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8948 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8949 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8950 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8951 /* Only show warning if item is not a box */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8952 warn = TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8953 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8954 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8955 if (boxtype == DW_VERT) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8956 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8957 x = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8958 y = boxcount; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8959 gtk_table_resize(GTK_TABLE(box), boxcount + 1, 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8960 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8961 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8962 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8963 x = boxcount; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8964 y = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8965 gtk_table_resize(GTK_TABLE(box), 1, boxcount + 1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8966 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8967 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8968 gtk_table_attach(GTK_TABLE(box), item, x, x + 1, y, y + 1, hsize ? DW_EXPAND : 0, vsize ? DW_EXPAND : 0, pad, pad); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8969 g_object_set_data(G_OBJECT(box), "_dw_boxcount", GINT_TO_POINTER(boxcount + 1)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8970 gtk_widget_set_size_request(item, width, height); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8971 if (GTK_IS_RADIO_BUTTON(item)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8972 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8973 GSList *group; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8974 GtkWidget *groupstart = (GtkWidget *)g_object_get_data(G_OBJECT(box), "_dw_group"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8975 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8976 if (groupstart) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8977 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8978 group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(groupstart)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8979 gtk_radio_button_set_group(GTK_RADIO_BUTTON(item), group); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8980 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8981 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8982 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8983 g_object_set_data(G_OBJECT(box), "_dw_group", (gpointer)item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8984 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8985 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8986 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8987 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8988 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8989 GtkWidget *vbox = gtk_vbox_new(FALSE, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8990 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8991 if (GTK_IS_TABLE(item) || (tmpitem && GTK_IS_TABLE(tmpitem))) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8992 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8993 GtkWidget *eventbox = (GtkWidget *)g_object_get_data(G_OBJECT(item), "_dw_eventbox"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8994 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8995 /* NOTE: I left in the ability to pack boxes with a size, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8996 * this eliminates that by forcing the size to 0. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8997 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8998 height = width = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8999 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9000 if (eventbox) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9001 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9002 int boxpad = (int)g_object_get_data(G_OBJECT(item), "_dw_boxpad"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9003 gtk_container_add(GTK_CONTAINER(eventbox), item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9004 gtk_container_set_border_width(GTK_CONTAINER(eventbox), boxpad); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9005 item = eventbox; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9006 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9007 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9008 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9009 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9010 /* Only show warning if item is not a box */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9011 warn = TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9012 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9013 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9014 gtk_container_set_border_width(GTK_CONTAINER(box), pad); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9015 gtk_container_add(GTK_CONTAINER(box), vbox); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9016 gtk_box_pack_end(GTK_BOX(vbox), item, TRUE, TRUE, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9017 gtk_widget_show(vbox); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9018 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9019 gtk_widget_set_size_request(item, width, height); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9020 g_object_set_data(G_OBJECT(box), "_dw_user", vbox); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9021 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9022 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9023 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9024 if (warn) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9025 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9026 if ( width == 0 && hsize == FALSE ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9027 dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9028 if ( height == 0 && vsize == FALSE ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9029 dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9030 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9031 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9032 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9033 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9034 * Sets the default focus item for a window/dialog. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9035 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9036 * window: Toplevel window or dialog. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9037 * defaultitem: Handle to the dialog item to be default. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9038 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9039 void dw_window_default(HWND window, HWND defaultitem) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9040 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9041 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9042 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9043 if(!window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9044 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9045 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9046 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9047 g_object_set_data(G_OBJECT(window), "_dw_defaultitem", (gpointer)defaultitem); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9048 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9049 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9050 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9051 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9052 * Sets window to click the default dialog item when an ENTER is pressed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9053 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9054 * window: Window (widget) to look for the ENTER press. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9055 * next: Window (widget) to move to next (or click) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9056 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9057 void dw_window_click_default(HWND window, HWND next) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9058 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9059 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9060 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9061 if(!window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9062 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9063 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9064 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9065 g_signal_connect(G_OBJECT(window), "key_press_event", G_CALLBACK(_default_key_press_event), next); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9066 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9067 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9068 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9069 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9070 * Returns some information about the current operating environment. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9071 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9072 * env: Pointer to a DWEnv struct. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9073 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9074 void dw_environment_query(DWEnv *env) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9075 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9076 struct utsname name; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9077 char tempbuf[100]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9078 int len, z; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9079 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9080 uname(&name); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9081 strcpy(env->osName, name.sysname); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9082 strcpy(tempbuf, name.release); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9083 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9084 env->MajorBuild = env->MinorBuild = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9085 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9086 len = strlen(tempbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9087 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9088 strcpy(env->buildDate, __DATE__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9089 strcpy(env->buildTime, __TIME__); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9090 env->DWMajorVersion = DW_MAJOR_VERSION; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9091 env->DWMinorVersion = DW_MINOR_VERSION; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9092 env->DWSubVersion = DW_SUB_VERSION; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9093 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9094 for(z=1;z<len;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9095 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9096 if(tempbuf[z] == '.') |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9097 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9098 tempbuf[z] = '\0'; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9099 env->MajorVersion = atoi(&tempbuf[z-1]); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9100 env->MinorVersion = atoi(&tempbuf[z+1]); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9101 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9102 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9103 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9104 env->MajorVersion = atoi(tempbuf); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9105 env->MinorVersion = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9106 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9107 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9108 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9109 * Opens a file dialog and queries user selection. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9110 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9111 * title: Title bar text for dialog. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9112 * defpath: The default path of the open dialog. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9113 * ext: Default file extention. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9114 * flags: DW_FILE_OPEN or DW_FILE_SAVE or DW_DIRECTORY_OPEN |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9115 * Returns: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9116 * NULL on error. A malloced buffer containing |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9117 * the file path on success. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9118 * |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9119 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9120 char *dw_file_browse(char *title, char *defpath, char *ext, int flags) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9121 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9122 GtkWidget *filew; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9123 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9124 GtkFileChooserAction action; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9125 GtkFileFilter *filter1 = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9126 GtkFileFilter *filter2 = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9127 gchar *button; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9128 char *filename = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9129 char buf[1000]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9130 char mypath[PATH_MAX+1]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9131 char cwd[PATH_MAX+1]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9132 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9133 switch (flags ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9134 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9135 case DW_DIRECTORY_OPEN: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9136 action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9137 button = GTK_STOCK_OPEN; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9138 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9139 case DW_FILE_OPEN: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9140 action = GTK_FILE_CHOOSER_ACTION_OPEN; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9141 button = GTK_STOCK_OPEN; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9142 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9143 case DW_FILE_SAVE: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9144 action = GTK_FILE_CHOOSER_ACTION_SAVE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9145 button = GTK_STOCK_SAVE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9146 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9147 default: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9148 dw_messagebox( "Coding error", DW_MB_OK|DW_MB_ERROR, "dw_file_browse() flags argument invalid."); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9149 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9150 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9151 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9152 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9153 filew = gtk_file_chooser_dialog_new ( title, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9154 NULL, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9155 action, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9156 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9157 button, GTK_RESPONSE_ACCEPT, |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9158 NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9159 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9160 if ( flags == DW_FILE_SAVE ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9161 gtk_file_chooser_set_do_overwrite_confirmation( GTK_FILE_CHOOSER( filew ), TRUE ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9162 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9163 if ( ext ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9164 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9165 filter1 = gtk_file_filter_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9166 sprintf( buf, "*.%s", ext ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9167 gtk_file_filter_add_pattern( filter1, (gchar *)buf ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9168 sprintf( buf, "\"%s\" files", ext ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9169 gtk_file_filter_set_name( filter1, (gchar *)buf ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9170 filter2 = gtk_file_filter_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9171 gtk_file_filter_add_pattern( filter2, (gchar *)"*" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9172 gtk_file_filter_set_name( filter2, (gchar *)"All Files" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9173 gtk_file_chooser_add_filter( GTK_FILE_CHOOSER( filew ), filter1 ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9174 gtk_file_chooser_add_filter( GTK_FILE_CHOOSER( filew ), filter2 ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9175 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9176 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9177 if ( defpath ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9178 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9179 if ( g_path_is_absolute( defpath ) ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9180 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9181 strcpy( mypath, defpath ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9182 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9183 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9184 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9185 if ( !getcwd(cwd, PATH_MAX ) ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9186 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9187 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9188 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9189 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9190 if ( rel2abs( defpath, cwd, mypath, PATH_MAX ) ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9191 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9192 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9193 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9194 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9195 gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( filew ), mypath ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9196 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9197 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9198 if ( gtk_dialog_run( GTK_DIALOG( filew ) ) == GTK_RESPONSE_ACCEPT ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9199 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9200 filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( filew ) ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9201 /*g_free (filename);*/ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9202 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9203 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9204 gtk_widget_destroy( filew ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9205 return filename; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9206 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9207 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9208 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9209 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9210 * Execute and external program in a seperate session. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9211 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9212 * program: Program name with optional path. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9213 * type: Either DW_EXEC_CON or DW_EXEC_GUI. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9214 * params: An array of pointers to string arguements. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9215 * Returns: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9216 * -1 on error. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9217 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9218 int dw_exec(char *program, int type, char **params) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9219 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9220 int ret = -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9221 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9222 if((ret = fork()) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9223 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9224 int i; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9225 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9226 for (i = 3; i < 256; i++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9227 close(i); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9228 setsid(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9229 if(type == DW_EXEC_GUI) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9230 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9231 execvp(program, params); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9232 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9233 else if(type == DW_EXEC_CON) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9234 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9235 char **tmpargs; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9236 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9237 if(!params) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9238 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9239 tmpargs = malloc(sizeof(char *)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9240 tmpargs[0] = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9241 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9242 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9243 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9244 int z = 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9245 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9246 while(params[z]) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9247 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9248 z++; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9249 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9250 tmpargs = malloc(sizeof(char *)*(z+3)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9251 z=0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9252 tmpargs[0] = "xterm"; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9253 tmpargs[1] = "-e"; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9254 while(params[z]) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9255 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9256 tmpargs[z+2] = params[z]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9257 z++; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9258 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9259 tmpargs[z+2] = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9260 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9261 execvp("xterm", tmpargs); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9262 free(tmpargs); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9263 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9264 /* If we got here exec failed */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9265 _exit(-1); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9266 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9267 return ret; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9268 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9269 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9270 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9271 * Loads a web browser pointed at the given URL. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9272 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9273 * url: Uniform resource locator. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9274 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9275 int dw_browse(char *url) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9276 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9277 /* Is there a way to find the webbrowser in Unix? */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9278 char *execargs[3], *browser = "netscape", *tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9279 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9280 tmp = getenv( "DW_BROWSER" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9281 if(tmp) browser = tmp; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9282 execargs[0] = browser; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9283 execargs[1] = url; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9284 execargs[2] = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9285 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9286 return dw_exec(browser, DW_EXEC_GUI, execargs); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9287 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9288 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9289 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9290 * Causes the embedded HTML widget to take action. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9291 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9292 * handle: Handle to the window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9293 * action: One of the DW_HTML_* constants. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9294 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9295 void dw_html_action(HWND handle, int action) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9296 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9297 #ifdef USE_GTKMOZEMBED |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9298 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9299 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9300 if(!_gtk_moz_embed_new) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9301 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9302 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9303 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9304 switch(action) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9305 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9306 case DW_HTML_GOBACK: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9307 _gtk_moz_embed_go_back(GTK_MOZ_EMBED(handle)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9308 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9309 case DW_HTML_GOFORWARD: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9310 _gtk_moz_embed_go_forward(GTK_MOZ_EMBED(handle)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9311 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9312 case DW_HTML_GOHOME: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9313 _gtk_moz_embed_load_url(GTK_MOZ_EMBED(handle), "http://dwindows.netlabs.org"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9314 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9315 case DW_HTML_RELOAD: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9316 _gtk_moz_embed_reload(GTK_MOZ_EMBED(handle), 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9317 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9318 case DW_HTML_STOP: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9319 _gtk_moz_embed_stop_load(GTK_MOZ_EMBED(handle)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9320 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9321 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9322 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9323 #elif defined(USE_WEBKIT) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9324 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9325 WebKitWebView *web_view; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9326 WebKitWebFrame *frame; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9327 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9328 if (!_webkit_web_view_open) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9329 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9330 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9331 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9332 web_view = (WebKitWebView *)g_object_get_data(G_OBJECT(handle), "_dw_web_view"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9333 if ( web_view ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9334 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9335 switch( action ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9336 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9337 case DW_HTML_GOBACK: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9338 _webkit_web_view_go_back( web_view ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9339 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9340 case DW_HTML_GOFORWARD: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9341 _webkit_web_view_go_forward( web_view ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9342 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9343 case DW_HTML_GOHOME: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9344 _webkit_web_view_open( web_view, "http://dwindows.netlabs.org" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9345 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9346 case DW_HTML_RELOAD: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9347 _webkit_web_view_reload( web_view ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9348 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9349 case DW_HTML_STOP: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9350 _webkit_web_view_stop_loading( web_view ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9351 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9352 # ifdef WEBKIT_CHECK_VERSION |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9353 # if WEBKIT_CHECK_VERSION(1,1,5) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9354 case DW_HTML_PRINT: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9355 frame = _webkit_web_view_get_focused_frame( web_view ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9356 _webkit_web_frame_print( frame ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9357 break; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9358 # endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9359 # endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9360 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9361 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9362 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9363 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9364 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9365 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9366 #ifdef USE_LIBGTKHTML2 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9367 void _dw_html_render_data( HWND handle, char *string, int i ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9368 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9369 HtmlDocument *document; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9370 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9371 html_view_set_document (HTML_VIEW(handle), NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9372 document = (HtmlDocument *)g_object_get_data(G_OBJECT(handle), "_dw_html_document" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9373 /* html_document_clear (document);*/ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9374 if ( document ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9375 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9376 html_view_set_document (HTML_VIEW(handle), document); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9377 if ( html_document_open_stream( document, "text/html" ) ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9378 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9379 html_document_write_stream( document, string, i ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9380 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9381 html_document_close_stream (document); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9382 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9383 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9384 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9385 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9386 * Render raw HTML code in the embedded HTML widget.. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9387 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9388 * handle: Handle to the window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9389 * string: String buffer containt HTML code to |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9390 * be rendered. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9391 * Returns: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9392 * 0 on success. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9393 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9394 int dw_html_raw(HWND handle, char *string) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9395 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9396 #ifdef USE_GTKMOZEMBED |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9397 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9398 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9399 if (!_gtk_moz_embed_new) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9400 return -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9401 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9402 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9403 _gtk_moz_embed_render_data(GTK_MOZ_EMBED(handle), string, strlen(string), "file:///", "text/html"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9404 gtk_widget_show(GTK_WIDGET(handle)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9405 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9406 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9407 #elif defined(USE_LIBGTKHTML2) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9408 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9409 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9410 if ( !_html_document_new ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9411 return -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9412 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9413 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9414 _dw_html_render_data( handle, string, strlen(string) ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9415 gtk_widget_show( GTK_WIDGET(handle) ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9416 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9417 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9418 #elif defined(USE_WEBKIT) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9419 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9420 WebKitWebView *web_view; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9421 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9422 if (!_webkit_web_view_open) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9423 return -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9424 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9425 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9426 web_view = (WebKitWebView *)g_object_get_data(G_OBJECT(handle), "_dw_web_view"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9427 if ( web_view ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9428 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9429 _webkit_web_view_load_html_string( web_view, string, "file:///"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9430 gtk_widget_show( GTK_WIDGET(handle) ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9431 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9432 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9433 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9434 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9435 return -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9436 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9437 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9438 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9439 * Render file or web page in the embedded HTML widget.. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9440 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9441 * handle: Handle to the window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9442 * url: Universal Resource Locator of the web or |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9443 * file object to be rendered. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9444 * Returns: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9445 * 0 on success. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9446 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9447 int dw_html_url(HWND handle, char *url) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9448 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9449 #ifdef USE_GTKMOZEMBED |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9450 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9451 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9452 if (!_gtk_moz_embed_new) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9453 return -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9454 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9455 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9456 _gtk_moz_embed_load_url( GTK_MOZ_EMBED(handle), url ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9457 gtk_widget_show(GTK_WIDGET(handle)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9458 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9459 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9460 #elif defined( USE_WEBKIT ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9461 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9462 WebKitWebView *web_view; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9463 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9464 if (!_webkit_web_view_open) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9465 return -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9466 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9467 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9468 web_view = (WebKitWebView *)g_object_get_data(G_OBJECT(handle), "_dw_web_view"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9469 if ( web_view ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9470 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9471 _webkit_web_view_open( web_view, url ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9472 gtk_widget_show(GTK_WIDGET(handle)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9473 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9474 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9475 return 0; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9476 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9477 return -1; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9478 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9479 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9480 #ifdef USE_GTKMOZEMBED |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9481 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9482 * Callback for a HTML widget when the "Forward" menu item is selected |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9483 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9484 static int _dw_html_forward_callback(HWND window, void *data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9485 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9486 HWND handle=(HWND)data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9487 dw_html_action( handle, DW_HTML_GOFORWARD ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9488 return TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9489 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9490 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9491 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9492 * Callback for a HTML widget when the "Back" menu item is selected |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9493 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9494 static int _dw_html_backward_callback(HWND window, void *data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9495 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9496 HWND handle=(HWND)data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9497 dw_html_action( handle, DW_HTML_GOBACK ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9498 return TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9499 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9500 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9501 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9502 * Callback for a HTML widget when the "Reload" menu item is selected |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9503 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9504 static int _dw_html_reload_callback(HWND window, void *data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9505 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9506 HWND handle=(HWND)data; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9507 dw_html_action( handle, DW_HTML_RELOAD ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9508 return TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9509 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9510 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9511 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9512 * Callback for a HTML widget when a page has completed loading |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9513 * Once the page has finished loading, show the widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9514 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9515 void _dw_html_net_stop_cb( GtkMozEmbed *embed, gpointer data ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9516 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9517 gtk_widget_show(GTK_WIDGET(data)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9518 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9519 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9520 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9521 * Callback for a HTML widget when a mouse button is clicked inside the widget |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9522 * If the right mouse button is clicked, popup a context menu |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9523 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9524 static gint _dw_dom_mouse_click_cb (GtkMozEmbed *dummy, gpointer dom_event, gpointer embed) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9525 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9526 gint button,rc; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9527 glong x,y; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9528 int flags; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9529 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9530 button = mozilla_get_mouse_event_button( dom_event ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9531 if ( button == 2 ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9532 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9533 HWND menuitem; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9534 HMENUI popup; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9535 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9536 * Right mouse button; display context menu |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9537 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9538 rc = mozilla_get_mouse_location( dom_event, &x, &y); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9539 popup = dw_menu_new( 0 ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9540 if ( _gtk_moz_embed_can_go_forward(GTK_MOZ_EMBED(embed) ) ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9541 flags = DW_MIS_ENABLED; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9542 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9543 flags = DW_MIS_DISABLED; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9544 menuitem = dw_menu_append_item( popup, "Forward", 1, flags, TRUE, FALSE, 0 ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9545 dw_signal_connect( menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_html_forward_callback), embed ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9546 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9547 if ( _gtk_moz_embed_can_go_back(GTK_MOZ_EMBED(embed) ) ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9548 flags = DW_MIS_ENABLED; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9549 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9550 flags = DW_MIS_DISABLED; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9551 menuitem = dw_menu_append_item( popup, "Back", 2, flags, TRUE, FALSE, 0 ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9552 dw_signal_connect( menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_html_backward_callback), embed ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9553 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9554 dw_menu_append_item( popup, DW_MENU_SEPARATOR, 99, 0, TRUE, FALSE, 0 ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9555 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9556 menuitem = dw_menu_append_item( popup, "Reload", 3, 0, TRUE, FALSE, 0 ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9557 dw_signal_connect( menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_html_reload_callback), embed ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9558 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9559 dw_menu_popup( &popup, embed, x, y ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9560 rc = TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9561 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9562 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9563 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9564 rc = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9565 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9566 return rc; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9567 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9568 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9569 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9570 #ifdef USE_LIBGTKHTML2 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9571 static gboolean dom_mouse_down( HtmlDocument *doc, DomMouseEvent *event, gpointer data ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9572 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9573 fprintf(stderr,"mouse down\n"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9574 return TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9575 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9576 static gboolean dom_mouse_up( HtmlDocument *doc, DomMouseEvent *event, gpointer data ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9577 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9578 fprintf(stderr,"mouse up\n"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9579 return TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9580 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9581 static gboolean dom_mouse_click( HtmlDocument *doc, DomMouseEvent *event, gpointer data ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9582 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9583 fprintf(stderr,"mouse click\n"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9584 return TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9585 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9586 static gboolean url_requested (HtmlDocument *doc, const gchar *url, HtmlStream *stream) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9587 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9588 fprintf(stderr,"URL IS REQUESTED: %s\n",url); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9589 return TRUE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9590 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9591 static void link_clicked (HtmlDocument *doc, const gchar *url) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9592 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9593 fprintf(stderr,"link clicked: %s!\n", url); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9594 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9595 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9596 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9597 #ifdef USE_WEBKIT |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9598 # ifdef WEBKIT_CHECK_VERSION |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9599 # if WEBKIT_CHECK_VERSION(1,1,5) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9600 static void _dw_html_print_cb( GtkWidget *widget, gpointer *data ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9601 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9602 WebKitWebView *web_view = DW_WEBKIT_WEB_VIEW(data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9603 WebKitWebFrame *frame; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9604 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9605 frame = _webkit_web_view_get_focused_frame( web_view ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9606 _webkit_web_frame_print( frame ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9607 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9608 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9609 * Fired when the user right-clicks to get the popup-menu on the HTML widget |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9610 * We add a "Print" menu item to enable printing |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9611 * user_data is not used |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9612 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9613 static void _dw_html_populate_popup_cb( WebKitWebView *web_view, GtkMenu *menu, gpointer user_data ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9614 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9615 GtkWidget *image = gtk_image_new_from_stock( GTK_STOCK_PRINT, GTK_ICON_SIZE_MENU ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9616 GtkWidget *item = gtk_image_menu_item_new_with_label( "Print" ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9617 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9618 gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(item), image ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9619 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9620 g_signal_connect( item, "activate", G_CALLBACK(_dw_html_print_cb), web_view ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9621 gtk_widget_show(item); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9622 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9623 # endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9624 # endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9625 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9626 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9627 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9628 * Create a new Entryfield window (widget) to be packed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9629 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9630 * text: The default text to be in the entryfield widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9631 * id: An ID to be used with dw_window_from_id() or 0L. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9632 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9633 HWND dw_html_new(unsigned long id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9634 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9635 GtkWidget *widget,*stext; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9636 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9637 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9638 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9639 #ifdef USE_GTKMOZEMBED |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9640 if (!_gtk_moz_embed_new) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9641 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9642 widget = dw_box_new(DW_HORZ, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9643 stext = dw_text_new( "HTML widget not available; you do not have access to gtkmozembed.", 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9644 dw_box_pack_start(widget, stext, 0, 0, TRUE, TRUE, 10); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9645 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9646 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9647 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9648 widget = _gtk_moz_embed_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9649 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9650 * Connect some signals |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9651 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9652 g_signal_connect( G_OBJECT(widget), "net-stop", G_CALLBACK(_dw_html_net_stop_cb), widget ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9653 g_signal_connect( G_OBJECT(widget), "dom_mouse_click", G_CALLBACK(_dw_dom_mouse_click_cb), widget ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9654 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9655 #elif defined(USE_LIBGTKHTML2) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9656 if ( !_html_document_new ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9657 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9658 widget = dw_box_new(DW_HORZ, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9659 stext = dw_text_new( "HTML widget not available; you do not have access to libgtkhtml-2.", 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9660 dw_box_pack_start(widget, stext, 0, 0, TRUE, TRUE, 10); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9661 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9662 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9663 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9664 HtmlDocument *document; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9665 document = html_document_new (); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9666 g_signal_connect (G_OBJECT (document), "dom_mouse_down", G_CALLBACK (dom_mouse_down), NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9667 g_signal_connect (G_OBJECT (document), "dom_mouse_up", G_CALLBACK (dom_mouse_up), NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9668 g_signal_connect (G_OBJECT (document), "dom_mouse_click", G_CALLBACK (dom_mouse_click), NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9669 g_signal_connect (G_OBJECT (document), "request_url", G_CALLBACK (url_requested), NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9670 g_signal_connect (G_OBJECT (document), "link_clicked", G_CALLBACK (link_clicked), NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9671 widget = _html_view_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9672 g_object_set_data(G_OBJECT(widget), "_dw_html_document", (gpointer)document); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9673 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9674 #elif defined(USE_WEBKIT) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9675 if (!_webkit_web_view_open) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9676 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9677 widget = dw_box_new(DW_HORZ, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9678 stext = dw_text_new( "HTML widget not available; you do not have access to webkit.", 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9679 dw_box_pack_start(widget, stext, 0, 0, TRUE, TRUE, 10); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9680 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9681 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9682 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9683 WebKitWebView *web_view; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9684 widget = gtk_scrolled_window_new (NULL, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9685 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW (widget), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9686 web_view = (WebKitWebView *)_webkit_web_view_new(); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9687 /* web_view = WEBKIT_WEB_VIEW(_webkit_web_view_new() ); */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9688 gtk_container_add( GTK_CONTAINER (widget), GTK_WIDGET(web_view) ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9689 gtk_widget_show( GTK_WIDGET(web_view) ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9690 g_object_set_data(G_OBJECT(widget), "_dw_web_view", (gpointer)web_view); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9691 # ifdef WEBKIT_CHECK_VERSION |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9692 # if WEBKIT_CHECK_VERSION(1,1,5) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9693 g_signal_connect( web_view, "populate-popup", G_CALLBACK(_dw_html_populate_popup_cb), NULL ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9694 # endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9695 # endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9696 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9697 #else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9698 widget = dw_box_new(DW_HORZ, 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9699 stext = dw_text_new( "HTML widget not available; you do not have access to gtkmozembed.", 0); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9700 dw_box_pack_start(widget, stext, 0, 0, TRUE, TRUE, 10); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9701 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9702 gtk_widget_show(widget); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9703 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9704 return widget; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9705 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9706 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9707 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9708 * Gets the contents of the default clipboard as text. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9709 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9710 * None. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9711 * Returns: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9712 * Pointer to an allocated string of text or NULL if clipboard empty or contents could not |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9713 * be converted to text. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9714 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9715 char *dw_clipboard_get_text() |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9716 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9717 int _locked_by_me = FALSE, index = _find_thread_index(dw_thread_id()); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9718 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9719 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9720 if ( _clipboard_object[index] == NULL ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9721 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9722 _clipboard_object[index] = gtk_clipboard_get( GDK_SELECTION_CLIPBOARD ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9723 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9724 if ( _clipboard_contents[index] != NULL ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9725 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9726 g_free( _clipboard_contents[index] ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9727 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9728 _clipboard_contents[index] = gtk_clipboard_wait_for_text( _clipboard_object[index] ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9729 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9730 return (char *)_clipboard_contents[index]; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9731 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9732 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9733 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9734 * Sets the contents of the default clipboard to the supplied text. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9735 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9736 * Text. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9737 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9738 void dw_clipboard_set_text( char *str, int len ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9739 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9740 int _locked_by_me = FALSE, index = _find_thread_index(dw_thread_id()); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9741 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9742 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9743 if ( _clipboard_object[index] == NULL ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9744 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9745 _clipboard_object[index] = gtk_clipboard_get( GDK_SELECTION_CLIPBOARD ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9746 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9747 gtk_clipboard_set_text( _clipboard_object[index], str, len ); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9748 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9749 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9750 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9751 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9752 * Returns a pointer to a static buffer which containes the |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9753 * current user directory. Or the root directory (C:\ on |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9754 * OS/2 and Windows). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9755 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9756 char *dw_user_dir(void) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9757 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9758 static char _user_dir[1024] = ""; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9759 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9760 if(!_user_dir[0]) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9761 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9762 char *home = getenv("HOME"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9763 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9764 if(home) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9765 strcpy(_user_dir, home); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9766 else |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9767 strcpy(_user_dir, "/"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9768 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9769 return _user_dir; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9770 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9771 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9772 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9773 * Call a function from the window (widget)'s context. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9774 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9775 * handle: Window handle of the widget. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9776 * function: Function pointer to be called. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9777 * data: Pointer to the data to be passed to the function. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9778 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9779 void dw_window_function(HWND handle, void *function, void *data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9780 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9781 void (* windowfunc)(void *); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9782 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9783 windowfunc = function; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9784 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9785 if(windowfunc) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9786 windowfunc(data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9787 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9788 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9789 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9790 * Add a named user data item to a window handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9791 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9792 * window: Window handle of signal to be called back. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9793 * dataname: A string pointer identifying which signal to be hooked. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9794 * data: User data to be passed to the handler function. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9795 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9796 void dw_window_set_data(HWND window, char *dataname, void *data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9797 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9798 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9799 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9800 if(!window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9801 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9802 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9803 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9804 if(GTK_IS_SCROLLED_WINDOW(window)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9805 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9806 HWND thiswindow = (HWND)g_object_get_data(G_OBJECT(window), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9807 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9808 if(thiswindow && G_IS_OBJECT(thiswindow)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9809 g_object_set_data(G_OBJECT(thiswindow), dataname, (gpointer)data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9810 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9811 if(GTK_IS_COMBO_BOX(window)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9812 g_object_set_data(G_OBJECT(GTK_COMBO_BOX(window)->entry), dataname, (gpointer)data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9813 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9814 g_object_set_data(G_OBJECT(window), dataname, (gpointer)data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9815 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9816 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9817 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9818 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9819 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9820 * Gets a named user data item to a window handle. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9821 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9822 * window: Window handle of signal to be called back. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9823 * dataname: A string pointer identifying which signal to be hooked. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9824 * data: User data to be passed to the handler function. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9825 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9826 void *dw_window_get_data(HWND window, char *dataname) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9827 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9828 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9829 void *ret = NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9830 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9831 if(!window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9832 return NULL; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9833 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9834 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9835 if(G_IS_OBJECT(window)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9836 ret = (void *)g_object_get_data(G_OBJECT(window), dataname); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9837 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9838 return ret; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9839 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9840 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9841 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9842 * Add a callback to a timer event. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9843 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9844 * interval: Milliseconds to delay between calls. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9845 * sigfunc: The pointer to the function to be used as the callback. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9846 * data: User data to be passed to the handler function. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9847 * Returns: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9848 * Timer ID for use with dw_timer_disconnect(), 0 on error. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9849 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9850 int API dw_timer_connect(int interval, void *sigfunc, void *data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9851 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9852 int tag, _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9853 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9854 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9855 tag = g_timeout_add(interval, (GSourceFunc)sigfunc, data); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9856 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9857 return tag; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9858 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9859 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9860 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9861 * Removes timer callback. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9862 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9863 * id: Timer ID returned by dw_timer_connect(). |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9864 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9865 void API dw_timer_disconnect(int id) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9866 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9867 #if 0 /* TODO: Can't remove by ID anymore apparently... |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9868 * need to rewrite it to return FALSE from the signal handler to stop. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9869 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9870 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9871 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9872 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9873 g_timeout_remove(id); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9874 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9875 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9876 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9877 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9878 /* Get the actual signal window handle not the user window handle |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9879 * Should mimic the code in dw_signal_connect() below. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9880 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9881 static HWND _find_signal_window(HWND window, char *signame) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9882 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9883 HWND thiswindow = window; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9884 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9885 if(GTK_IS_SCROLLED_WINDOW(thiswindow)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9886 thiswindow = (HWND)g_object_get_data(G_OBJECT(window), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9887 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9888 else if(GTK_IS_COMBO_BOX(thiswindow) && signame && strcmp(signame, DW_SIGNAL_LIST_SELECT) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9889 thiswindow = GTK_COMBO_BOX(thiswindow)->list; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9890 else if(GTK_IS_COMBO_BOX(thiswindow) && signame && strcmp(signame, DW_SIGNAL_SET_FOCUS) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9891 thiswindow = GTK_COMBO_BOX(thiswindow)->entry; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9892 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9893 else if(GTK_IS_VSCALE(thiswindow) || GTK_IS_HSCALE(thiswindow) || |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9894 GTK_IS_VSCROLLBAR(thiswindow) || GTK_IS_HSCROLLBAR(thiswindow) || |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9895 GTK_IS_SPIN_BUTTON(thiswindow)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9896 thiswindow = (GtkWidget *)g_object_get_data(G_OBJECT(thiswindow), "_dw_adjustment"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9897 else if(GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9898 thiswindow = (GtkWidget *)gtk_tree_view_get_selection(GTK_TREE_VIEW(thiswindow)); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9899 return thiswindow; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9900 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9901 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9902 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9903 * Add a callback to a window event. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9904 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9905 * window: Window handle of signal to be called back. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9906 * signame: A string pointer identifying which signal to be hooked. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9907 * sigfunc: The pointer to the function to be used as the callback. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9908 * data: User data to be passed to the handler function. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9909 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9910 void dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9911 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9912 void *thisfunc = _findsigfunc(signame); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9913 char *thisname = signame; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9914 HWND thiswindow = window; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9915 int sigid, _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9916 gint cid; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9917 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9918 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9919 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9920 * If the window we are setting the signal on is a scrolled window we need to get |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9921 * the "real" widget type. thiswindow is the "real" widget type |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9922 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9923 if (GTK_IS_SCROLLED_WINDOW(thiswindow)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9924 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9925 thiswindow = (HWND)g_object_get_data(G_OBJECT(window), "_dw_user"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9926 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9927 |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9928 if (strcmp(signame, DW_SIGNAL_EXPOSE) == 0) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9929 { |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9930 thisname = "draw"; |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9931 } |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9932 else if (GTK_IS_MENU_ITEM(thiswindow) && strcmp(signame, DW_SIGNAL_CLICKED) == 0) |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9933 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9934 thisname = "activate"; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9935 thisfunc = _findsigfunc(thisname); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9936 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9937 else if (GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_CONTEXT) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9938 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9939 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9940 cid = g_signal_connect(G_OBJECT(thiswindow), "button_press_event", G_CALLBACK(thisfunc), (gpointer)sigid); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9941 _set_signal_handler_id(thiswindow, sigid, cid); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9942 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9943 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9944 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9945 } |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9946 else if ((GTK_IS_TREE_VIEW(thiswindow) || GTK_IS_COMBO_BOX(thiswindow)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9947 && (strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0 || strcmp(signame, DW_SIGNAL_LIST_SELECT) == 0)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9948 { |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9949 GtkWidget *widget = thiswindow; |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9950 |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9951 thisname = "changed"; |
779
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9952 |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9953 sigid = _set_signal_handler(widget, window, sigfunc, data, thisfunc); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9954 if(GTK_IS_TREE_VIEW(thiswindow)) |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9955 { |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9956 thiswindow = (GtkWidget *)gtk_tree_view_get_selection(GTK_TREE_VIEW(thiswindow)); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9957 cid = g_signal_connect(G_OBJECT(thiswindow), thisname, G_CALLBACK(thisfunc), (gpointer)sigid); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9958 _set_signal_handler_id(widget, sigid, cid); |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9959 } |
d67d2f626c33
More code and cleanups for listboxes/combobox and event handling...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
778
diff
changeset
|
9960 |
775
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9961 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9962 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9963 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9964 else if (GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_TREE_EXPAND) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9965 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9966 thisname = "row-expanded"; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9967 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9968 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9969 else if (GTK_IS_CLIST(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_ENTER) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9970 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9971 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, _container_enter_event); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9972 cid = g_signal_connect(G_OBJECT(thiswindow), "key_press_event", GTK_SIGNAL_FUNC(_container_enter_event), (gpointer)sigid); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9973 _set_signal_handler_id(thiswindow, sigid, cid); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9974 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9975 thisname = "button_press_event"; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9976 thisfunc = _findsigfunc(DW_SIGNAL_ITEM_ENTER); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9977 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9978 else if (GTK_IS_CLIST(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9979 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9980 thisname = "select_row"; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9981 thisfunc = (void *)_container_select_row; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9982 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9983 else if (GTK_IS_CLIST(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_CONTEXT) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9984 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9985 thisname = "button_press_event"; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9986 thisfunc = _findsigfunc(DW_SIGNAL_ITEM_CONTEXT); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9987 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9988 else if (GTK_IS_CLIST(thiswindow) && strcmp(signame, DW_SIGNAL_COLUMN_CLICK) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9989 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9990 thisname = "click-column"; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9991 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9992 else if (GTK_IS_COMBO_BOX(thiswindow) && strcmp(signame, DW_SIGNAL_LIST_SELECT) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9993 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9994 thisname = "select_child"; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9995 thiswindow = GTK_COMBO_BOX(thiswindow)->list; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9996 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9997 else if (GTK_IS_LIST(thiswindow) && strcmp(signame, DW_SIGNAL_LIST_SELECT) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9998 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9999 thisname = "select_child"; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10000 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10001 else if (strcmp(signame, DW_SIGNAL_SET_FOCUS) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10002 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10003 thisname = "focus-in-event"; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10004 if (GTK_IS_COMBO_BOX(thiswindow)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10005 thiswindow = GTK_COMBO_BOX(thiswindow)->entry; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10006 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10007 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10008 #if 0 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10009 else if (strcmp(signame, DW_SIGNAL_LOSE_FOCUS) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10010 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10011 thisname = "focus-out-event"; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10012 if(GTK_IS_COMBO_BOX(thiswindow)) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10013 thiswindow = GTK_COMBO_BOX(thiswindow)->entry; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10014 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10015 #endif |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10016 else if (GTK_IS_VSCALE(thiswindow) || GTK_IS_HSCALE(thiswindow) || |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10017 GTK_IS_VSCROLLBAR(thiswindow) || GTK_IS_HSCROLLBAR(thiswindow) || |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10018 GTK_IS_SPIN_BUTTON(thiswindow) ) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10019 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10020 thiswindow = (GtkWidget *)g_object_get_data(G_OBJECT(thiswindow), "_dw_adjustment"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10021 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10022 else if (GTK_IS_NOTEBOOK(thiswindow) && strcmp(signame, DW_SIGNAL_SWITCH_PAGE) == 0) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10023 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10024 thisname = "switch-page"; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10025 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10026 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10027 if (!thisfunc || !thiswindow) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10028 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10029 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10030 return; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10031 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10032 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10033 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10034 cid = g_signal_connect(G_OBJECT(thiswindow), thisname, G_CALLBACK(thisfunc),(gpointer)sigid); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10035 _set_signal_handler_id(thiswindow, sigid, cid); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10036 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10037 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10038 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10039 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10040 * Removes callbacks for a given window with given name. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10041 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10042 * window: Window handle of callback to be removed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10043 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10044 void dw_signal_disconnect_by_name(HWND window, char *signame) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10045 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10046 HWND thiswindow; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10047 int z, count; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10048 void *thisfunc; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10049 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10050 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10051 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10052 thiswindow = _find_signal_window(window, signame); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10053 count = (int)g_object_get_data(G_OBJECT(thiswindow), "_dw_sigcounter"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10054 thisfunc = _findsigfunc(signame); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10055 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10056 for(z=0;z<count;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10057 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10058 SignalHandler sh = _get_signal_handler(thiswindow, (gpointer)z); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10059 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10060 if(sh.intfunc == thisfunc) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10061 _remove_signal_handler(thiswindow, z); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10062 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10063 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10064 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10065 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10066 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10067 * Removes all callbacks for a given window. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10068 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10069 * window: Window handle of callback to be removed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10070 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10071 void dw_signal_disconnect_by_window(HWND window) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10072 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10073 HWND thiswindow; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10074 int z, count; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10075 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10076 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10077 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10078 thiswindow = _find_signal_window(window, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10079 count = (int)g_object_get_data(G_OBJECT(thiswindow), "_dw_sigcounter"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10080 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10081 for(z=0;z<count;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10082 _remove_signal_handler(thiswindow, z); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10083 g_object_set_data(G_OBJECT(thiswindow), "_dw_sigcounter", NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10084 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10085 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10086 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10087 /* |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10088 * Removes all callbacks for a given window with specified data. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10089 * Parameters: |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10090 * window: Window handle of callback to be removed. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10091 * data: Pointer to the data to be compared against. |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10092 */ |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10093 void dw_signal_disconnect_by_data(HWND window, void *data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10094 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10095 HWND thiswindow; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10096 int z, count; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10097 int _locked_by_me = FALSE; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10098 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10099 DW_MUTEX_LOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10100 thiswindow = _find_signal_window(window, NULL); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10101 count = (int)g_object_get_data(G_OBJECT(thiswindow), "_dw_sigcounter"); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10102 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10103 for(z=0;z<count;z++) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10104 { |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10105 SignalHandler sh = _get_signal_handler(thiswindow, (gpointer)z); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10106 |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10107 if(sh.data == data) |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10108 _remove_signal_handler(thiswindow, z); |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10109 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10110 DW_MUTEX_UNLOCK; |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10111 } |
5ec50e403a8a
Added initial support for GTK 3.0. Split it off into its own directory.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10112 |