Mercurial > dwindows
annotate gtk4/dw.c @ 2264:5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
compile yet. GTK4 support will likely be less full than GTK3 due to
architectural decisions by the GTK team. Certain features have been removed
with no replacements, such as status icon support. Additionally all of the
thread safety has been removed and everything MUST run on the main thread.
I will likely implement a similar solution to what I did on MacOS where
threads will call into the main thread to do API calls, passing the
arguments between threads. Copied from GTK3 removing all existing now dead
thread safety, all deprecated code and everything supporting earlier
versions of GTK3. GTK4 is not available in any mainstream distributions
yet... hoping to have it at least functional by the time there are any.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 29 Jan 2021 10:57:12 +0000 |
parents | |
children | 63bb97e94cd3 |
rev | line source |
---|---|
2264
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2 * Dynamic Windows: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3 * A GTK like cross-platform GUI |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4 * GTK4 forwarder module for portabilty. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5 * |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6 * (C) 2000-2021 Brian Smith <brian@dbsoft.org> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7 * (C) 2003-2011 Mark Hessling <mark@rexx.org> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9 #include "dwconfig.h" |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10 #include "dw.h" |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11 #include <glib/gi18n.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
12 #include <string.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
13 #include <stdlib.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
14 #include <sys/utsname.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
15 #include <sys/socket.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
16 #include <sys/un.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
17 #include <sys/mman.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
18 #include <stdarg.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
19 #include <stdio.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
20 #include <unistd.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
21 #include <ctype.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
22 #include <errno.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
23 #include <sys/time.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
24 #include <dirent.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
25 #include <sys/stat.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
26 #include <signal.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
27 #include <fcntl.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
28 #include <unistd.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
29 #include <math.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
30 #include <gdk/gdkkeysyms.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
31 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
32 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
33 #ifdef USE_WEBKIT |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
34 #include <webkit2/webkit2.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
35 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
36 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
37 #include <gdk-pixbuf/gdk-pixbuf.h> |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
38 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
39 #if __STDC_VERSION__ < 199901L |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
40 # if __GNUC__ >= 2 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
41 # define __func__ __FUNCTION__ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
42 # else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
43 # define __func__ "<unknown>" |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
44 # endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
45 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
46 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
47 /* ff = 255 = 1.0000 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
48 * ee = 238 = 0.9333 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
49 * cc = 204 = 0.8000 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
50 * bb = 187 = 0.7333 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
51 * aa = 170 = 0.6667 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
52 * 77 = 119 = 0.4667 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
53 * 00 = 0 = 0.0000 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
54 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
55 GdkRGBA _colors[] = |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
56 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
57 { 0.0000, 0.0000, 0.0000, 1.0 }, /* 0 black */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
58 { 0.7333, 0.0000, 0.0000, 1.0 }, /* 1 red */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
59 { 0.0000, 0.7333, 0.0000, 1.0 }, /* 2 green */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
60 { 0.6667, 0.6667, 0.0000, 1.0 }, /* 3 yellow */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
61 { 0.0000, 0.0000, 0.8000, 1.0 }, /* 4 blue */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
62 { 0.7333, 0.0000, 0.7333, 1.0 }, /* 5 magenta */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
63 { 0.0000, 0.7333, 0.7333, 1.0 }, /* 6 cyan */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
64 { 0.7333, 0.7333, 0.7333, 1.0 }, /* 7 white */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
65 { 0.4667, 0.4667, 0.4667, 1.0 }, /* 8 grey */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
66 { 1.0000, 0.0000, 0.0000, 1.0 }, /* 9 bright red */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
67 { 0.0000, 1.0000, 0.0000, 1.0 }, /* 10 bright green */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
68 { 0.9333, 0.9333, 0.0000, 1.0 }, /* 11 bright yellow */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
69 { 0.0000, 0.0000, 1.0000, 1.0 }, /* 12 bright blue */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
70 { 1.0000, 0.0000, 1.0000, 1.0 }, /* 13 bright magenta */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
71 { 0.0000, 0.9333, 0.9333, 1.0 }, /* 14 bright cyan */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
72 { 1.0000, 1.0000, 1.0000, 1.0 }, /* 15 bright white */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
73 }; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
74 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
75 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
76 * List those icons that have transparency first |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
77 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
78 #define NUM_EXTS 9 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
79 char *image_exts[NUM_EXTS] = |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
80 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
81 ".xpm", |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
82 ".png", |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
83 ".ico", |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
84 ".icns", |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
85 ".gif", |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
86 ".jpg", |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
87 ".jpeg", |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
88 ".tiff", |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
89 ".bmp" |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
90 }; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
91 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
92 #ifndef max |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
93 # define max(a,b) (((a) > (b)) ? (a) : (b)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
94 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
95 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
96 #ifndef min |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
97 # define min(a,b) (((a) < (b)) ? (a) : (b)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
98 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
99 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
100 pthread_key_t _dw_fg_color_key; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
101 pthread_key_t _dw_bg_color_key; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
102 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
103 GtkWidget *last_window = NULL, *popup = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
104 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
105 static int _dw_ignore_click = 0, _dw_ignore_expand = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
106 static pthread_t _dw_thread = (pthread_t)-1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
107 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
108 #define DEFAULT_SIZE_WIDTH 12 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
109 #define DEFAULT_SIZE_HEIGHT 6 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
110 #define DEFAULT_TITLEBAR_HEIGHT 22 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
111 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
112 #define _DW_TREE_TYPE_CONTAINER 1 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
113 #define _DW_TREE_TYPE_TREE 2 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
114 #define _DW_TREE_TYPE_LISTBOX 3 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
115 #define _DW_TREE_TYPE_COMBOBOX 4 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
116 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
117 /* Signal forwarder prototypes */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
118 static gint _button_press_event(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
119 static gint _button_release_event(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
120 static gint _motion_notify_event(GtkEventControllerMotion *controller, double x, double y, gpointer data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
121 static gint _delete_event(GtkWidget *widget, gpointer data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
122 static gint _key_press_event(GtkEventControllerKey *controller, guint keyval, guint keycode, GdkModifierType state, gpointer data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
123 static gint _generic_event(GtkWidget *widget, gpointer data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
124 static gint _configure_event(GtkWidget *widget, GdkEvent *event, gpointer data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
125 static gint _activate_event(GtkWidget *widget, gpointer data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
126 static gint _container_enter_event(GtkWidget *widget, GdkEvent *event, gpointer data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
127 static gint _combobox_select_event(GtkWidget *widget, gpointer data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
128 static gint _expose_event(GtkWidget *widget, cairo_t *cr, gpointer data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
129 static gint _set_focus_event(GtkWindow *window, GtkWidget *widget, gpointer data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
130 static gint _tree_context_event(GtkWidget *widget, GdkEvent *event, gpointer data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
131 static gint _value_changed_event(GtkWidget *widget, gpointer user_data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
132 static gint _tree_select_event(GtkTreeSelection *sel, gpointer data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
133 static gint _tree_expand_event(GtkTreeView *treeview, GtkTreeIter *arg1, GtkTreePath *arg2, gpointer data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
134 static gint _switch_page_event(GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
135 static gint _column_click_event(GtkWidget *widget, gpointer data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
136 static void _html_result_event(GObject *object, GAsyncResult *result, gpointer script_data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
137 #ifdef USE_WEBKIT |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
138 static void _html_changed_event(WebKitWebView *web_view, WebKitLoadEvent load_event, gpointer data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
139 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
140 static void _dw_signal_disconnect(gpointer data, GClosure *closure); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
141 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
142 GObject *_DWObject = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
143 GApplication *_DWApp = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
144 static char _dw_app_id[_DW_APP_ID_SIZE+1] = { 0 }; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
145 char *_DWDefaultFont = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
146 static char _dw_share_path[PATH_MAX+1] = { 0 }; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
147 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
148 typedef struct |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
149 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
150 void *func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
151 char name[30]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
152 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
153 } SignalList; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
154 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
155 typedef struct |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
156 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
157 HWND window; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
158 void *func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
159 gpointer data; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
160 gint cid; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
161 void *intfunc; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
162 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
163 } SignalHandler; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
164 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
165 #define SIGNALMAX 20 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
166 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
167 /* A list of signal forwarders, to account for paramater differences. */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
168 static SignalList SignalTranslate[SIGNALMAX] = { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
169 { _configure_event, DW_SIGNAL_CONFIGURE }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
170 { _key_press_event, DW_SIGNAL_KEY_PRESS }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
171 { _button_press_event, DW_SIGNAL_BUTTON_PRESS }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
172 { _button_release_event, DW_SIGNAL_BUTTON_RELEASE }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
173 { _motion_notify_event, DW_SIGNAL_MOTION_NOTIFY }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
174 { _delete_event, DW_SIGNAL_DELETE }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
175 { _expose_event, DW_SIGNAL_EXPOSE }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
176 { _activate_event, "activate" }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
177 { _generic_event, DW_SIGNAL_CLICKED }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
178 { _container_enter_event, DW_SIGNAL_ITEM_ENTER }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
179 { _tree_context_event, DW_SIGNAL_ITEM_CONTEXT }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
180 { _combobox_select_event, DW_SIGNAL_LIST_SELECT }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
181 { _tree_select_event, DW_SIGNAL_ITEM_SELECT }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
182 { _set_focus_event, DW_SIGNAL_SET_FOCUS }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
183 { _value_changed_event, DW_SIGNAL_VALUE_CHANGED }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
184 { _switch_page_event, DW_SIGNAL_SWITCH_PAGE }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
185 { _column_click_event, DW_SIGNAL_COLUMN_CLICK }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
186 { _tree_expand_event, DW_SIGNAL_TREE_EXPAND }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
187 #ifdef USE_WEBKIT |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
188 { _html_changed_event, DW_SIGNAL_HTML_CHANGED }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
189 #else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
190 { _generic_event, DW_SIGNAL_HTML_CHANGED }, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
191 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
192 { _html_result_event, DW_SIGNAL_HTML_RESULT } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
193 }; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
194 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
195 /* Alignment flags */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
196 #define DW_CENTER 0.5f |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
197 #define DW_LEFT 0.0f |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
198 #define DW_RIGHT 1.0f |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
199 #define DW_TOP 0.0f |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
200 #define DW_BOTTOM 1.0f |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
201 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
202 static void _dw_msleep(long period) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
203 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
204 #ifdef __sun__ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
205 /* usleep() isn't threadsafe on Solaris */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
206 struct timespec req; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
207 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
208 req.tv_sec = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
209 if(period >= 1000) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
210 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
211 req.tv_sec = (int)(period / 1000); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
212 period -= (req.tv_sec * 1000); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
213 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
214 req.tv_nsec = period * 10000000; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
215 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
216 nanosleep(&req, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
217 #else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
218 usleep(period * 1000); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
219 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
220 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
221 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
222 /* Finds the translation function for a given signal name */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
223 static void *_findsigfunc(const char *signame) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
224 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
225 int z; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
226 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
227 for(z=0;z<SIGNALMAX;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
228 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
229 if(strcasecmp(signame, SignalTranslate[z].name) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
230 return SignalTranslate[z].func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
231 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
232 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
233 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
234 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
235 static SignalHandler _get_signal_handler(gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
236 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
237 SignalHandler sh = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
238 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
239 if(data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
240 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
241 void **params = (void **)data; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
242 int counter = GPOINTER_TO_INT(params[0]); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
243 GtkWidget *widget = (GtkWidget *)params[2]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
244 char text[100]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
245 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
246 sprintf(text, "_dw_sigwindow%d", counter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
247 sh.window = (HWND)g_object_get_data(G_OBJECT(widget), text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
248 sprintf(text, "_dw_sigfunc%d", counter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
249 sh.func = (void *)g_object_get_data(G_OBJECT(widget), text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
250 sprintf(text, "_dw_intfunc%d", counter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
251 sh.intfunc = (void *)g_object_get_data(G_OBJECT(widget), text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
252 sprintf(text, "_dw_sigdata%d", counter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
253 sh.data = g_object_get_data(G_OBJECT(widget), text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
254 sprintf(text, "_dw_sigcid%d", counter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
255 sh.cid = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), text)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
256 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
257 return sh; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
258 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
259 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
260 static void _remove_signal_handler(GtkWidget *widget, int counter) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
261 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
262 char text[100]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
263 gint cid; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
264 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
265 sprintf(text, "_dw_sigcid%d", counter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
266 cid = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), text)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
267 g_signal_handler_disconnect(G_OBJECT(widget), cid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
268 g_object_set_data(G_OBJECT(widget), text, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
269 sprintf(text, "_dw_sigwindow%d", counter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
270 g_object_set_data(G_OBJECT(widget), text, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
271 sprintf(text, "_dw_sigfunc%d", counter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
272 g_object_set_data(G_OBJECT(widget), text, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
273 sprintf(text, "_dw_intfunc%d", counter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
274 g_object_set_data(G_OBJECT(widget), text, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
275 sprintf(text, "_dw_sigdata%d", counter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
276 g_object_set_data(G_OBJECT(widget), text, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
277 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
278 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
279 static int _set_signal_handler(GtkWidget *widget, HWND window, void *func, gpointer data, void *intfunc, void *discfunc) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
280 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
281 int counter = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "_dw_sigcounter")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
282 char text[100]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
283 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
284 sprintf(text, "_dw_sigwindow%d", counter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
285 g_object_set_data(G_OBJECT(widget), text, (gpointer)window); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
286 sprintf(text, "_dw_sigfunc%d", counter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
287 g_object_set_data(G_OBJECT(widget), text, (gpointer)func); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
288 sprintf(text, "_dw_intfunc%d", counter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
289 g_object_set_data(G_OBJECT(widget), text, (gpointer)intfunc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
290 sprintf(text, "_dw_discfunc%d", counter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
291 g_object_set_data(G_OBJECT(widget), text, (gpointer)discfunc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
292 sprintf(text, "_dw_sigdata%d", counter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
293 g_object_set_data(G_OBJECT(widget), text, (gpointer)data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
294 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
295 counter++; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
296 g_object_set_data(G_OBJECT(widget), "_dw_sigcounter", GINT_TO_POINTER(counter)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
297 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
298 return counter - 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
299 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
300 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
301 static void _set_signal_handler_id(GtkWidget *widget, int counter, gint cid) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
302 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
303 char text[100]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
304 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
305 sprintf(text, "_dw_sigcid%d", counter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
306 g_object_set_data(G_OBJECT(widget), text, GINT_TO_POINTER(cid)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
307 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
308 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
309 static void _html_result_event(GObject *object, GAsyncResult *result, gpointer script_data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
310 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
311 #ifdef USE_WEBKIT |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
312 pthread_t saved_thread = _dw_thread; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
313 WebKitJavascriptResult *js_result; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
314 JSCValue *value; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
315 GError *error = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
316 int (*htmlresultfunc)(HWND, int, char *, void *, void *) = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
317 gint handlerdata = GPOINTER_TO_INT(g_object_get_data(object, "_dw_html_result_id")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
318 void *user_data = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
319 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
320 _dw_thread = (pthread_t)-1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
321 if(handlerdata) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
322 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
323 SignalHandler work; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
324 void *params[3] = { GINT_TO_POINTER(handlerdata-1), 0, object }; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
325 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
326 work = _get_signal_handler(params); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
327 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
328 if(work.window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
329 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
330 htmlresultfunc = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
331 user_data = work.data; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
332 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
333 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
334 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
335 if(!(js_result = webkit_web_view_run_javascript_finish(WEBKIT_WEB_VIEW(object), result, &error))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
336 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
337 if(htmlresultfunc) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
338 htmlresultfunc((HWND)object, DW_ERROR_UNKNOWN, error->message, script_data, user_data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
339 g_error_free (error); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
340 _dw_thread = saved_thread; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
341 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
342 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
343 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
344 value = webkit_javascript_result_get_js_value(js_result); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
345 if(jsc_value_is_string(value)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
346 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
347 gchar *str_value = jsc_value_to_string(value); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
348 JSCException *exception = jsc_context_get_exception(jsc_value_get_context(value)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
349 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
350 if(htmlresultfunc) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
351 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
352 if(exception) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
353 htmlresultfunc((HWND)object, DW_ERROR_UNKNOWN, (char *)jsc_exception_get_message(exception), script_data, user_data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
354 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
355 htmlresultfunc((HWND)object, DW_ERROR_NONE, str_value, script_data, user_data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
356 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
357 g_free (str_value); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
358 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
359 else if(htmlresultfunc) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
360 htmlresultfunc((HWND)object, DW_ERROR_UNKNOWN, NULL, script_data, user_data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
361 webkit_javascript_result_unref (js_result); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
362 _dw_thread = saved_thread; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
363 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
364 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
365 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
366 #ifdef USE_WEBKIT |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
367 static void _html_changed_event(WebKitWebView *web_view, WebKitLoadEvent load_event, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
368 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
369 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
370 char *location = (char *)webkit_web_view_get_uri(web_view); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
371 int status = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
372 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
373 switch (load_event) { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
374 case WEBKIT_LOAD_STARTED: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
375 status = DW_HTML_CHANGE_STARTED; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
376 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
377 case WEBKIT_LOAD_REDIRECTED: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
378 status = DW_HTML_CHANGE_REDIRECT; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
379 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
380 case WEBKIT_LOAD_COMMITTED: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
381 status = DW_HTML_CHANGE_LOADING; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
382 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
383 case WEBKIT_LOAD_FINISHED: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
384 status = DW_HTML_CHANGE_COMPLETE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
385 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
386 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
387 if(status && location && work.window && work.func) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
388 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
389 int (*htmlchangedfunc)(HWND, int, char *, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
390 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
391 htmlchangedfunc(work.window, status, location, work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
392 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
393 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
394 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
395 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
396 static gint _set_focus_event(GtkWindow *window, GtkWidget *widget, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
397 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
398 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
399 int retval = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
400 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
401 if(work.window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
402 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
403 int (*setfocusfunc)(HWND, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
404 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
405 retval = setfocusfunc(work.window, work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
406 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
407 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
408 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
409 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
410 static gint _button_press_event(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
411 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
412 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
413 int retval = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
414 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
415 if(work.window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
416 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
417 int (*buttonfunc)(HWND, int, int, int, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
418 /* TODO: Fill these in */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
419 int mybutton = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
420 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
421 #if GTK3 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
422 if(event->button == 3) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
423 mybutton = 2; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
424 else if(event->button == 2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
425 mybutton = 3; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
426 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
427 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
428 retval = buttonfunc(work.window, (int)x, (int)y, mybutton, work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
429 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
430 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
431 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
432 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
433 static gint _button_release_event(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
434 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
435 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
436 int retval = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
437 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
438 if(work.window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
439 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
440 int (*buttonfunc)(HWND, int, int, int, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
441 /* TODO: Fill these in */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
442 int mybutton = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
443 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
444 #if GTK3 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
445 if(event->button == 3) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
446 mybutton = 2; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
447 else if(event->button == 2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
448 mybutton = 3; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
449 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
450 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
451 retval = buttonfunc(work.window, (int)x, (int)y, mybutton, work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
452 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
453 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
454 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
455 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
456 static gint _motion_notify_event(GtkEventControllerMotion *controller, double x, double y, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
457 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
458 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
459 int retval = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
460 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
461 if(work.window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
462 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
463 int (*motionfunc)(HWND, int, int, int, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
464 int keys = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
465 /* TODO: Fill these in */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
466 GdkModifierType state = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
467 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
468 if (state & GDK_BUTTON1_MASK) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
469 keys = DW_BUTTON1_MASK; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
470 if (state & GDK_BUTTON3_MASK) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
471 keys |= DW_BUTTON2_MASK; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
472 if (state & GDK_BUTTON2_MASK) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
473 keys |= DW_BUTTON3_MASK; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
474 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
475 retval = motionfunc(work.window, (int)x, (int)y, keys, work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
476 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
477 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
478 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
479 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
480 static gint _delete_event(GtkWidget *widget, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
481 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
482 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
483 int retval = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
484 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
485 if(work.window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
486 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
487 int (*closefunc)(HWND, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
488 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
489 retval = closefunc(work.window, work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
490 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
491 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
492 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
493 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
494 static gint _key_press_event(GtkEventControllerKey *controller, guint keyval, guint keycode, GdkModifierType state, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
495 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
496 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
497 int retval = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
498 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
499 if(work.window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
500 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
501 int (*keypressfunc)(HWND, char, int, int, void *, char *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
502 guint32 unichar = gdk_keyval_to_unicode(keyval); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
503 char utf8[7] = { 0 }; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
504 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
505 g_unichar_to_utf8(unichar, utf8); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
506 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
507 retval = keypressfunc(work.window, (char)keycode, keyval, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
508 state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_ALT_MASK), work.data, utf8); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
509 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
510 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
511 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
512 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
513 static gint _generic_event(GtkWidget *widget, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
514 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
515 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
516 int retval = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
517 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
518 if(work.window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
519 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
520 int (*genericfunc)(HWND, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
521 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
522 retval = genericfunc(work.window, work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
523 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
524 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
525 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
526 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
527 static gint _activate_event(GtkWidget *widget, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
528 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
529 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
530 int retval = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
531 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
532 if(work.window && !_dw_ignore_click) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
533 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
534 int (*activatefunc)(HWND, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
535 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
536 retval = activatefunc(popup ? popup : work.window, work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
537 popup = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
538 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
539 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
540 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
541 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
542 static gint _configure_event(GtkWidget *widget, GdkEvent *event, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
543 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
544 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
545 int retval = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
546 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
547 if(work.window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
548 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
549 int (*sizefunc)(HWND, int, int, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
550 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
551 retval = sizefunc(work.window, 100, 100, work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
552 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
553 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
554 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
555 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
556 static gint _expose_event(GtkWidget *widget, cairo_t *cr, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
557 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
558 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
559 int retval = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
560 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
561 if(work.window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
562 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
563 DWExpose exp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
564 int (*exposefunc)(HWND, DWExpose *, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
565 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
566 exp.x = exp.y = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
567 exp.width = gtk_widget_get_allocated_width(widget); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
568 exp.height = gtk_widget_get_allocated_height(widget); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
569 retval = exposefunc(work.window, &exp, work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
570 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
571 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
572 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
573 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
574 static gint _combobox_select_event(GtkWidget *widget, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
575 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
576 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
577 int retval = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
578 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
579 if(g_object_get_data(G_OBJECT(widget), "_dw_recursing")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
580 return FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
581 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
582 if(work.window && GTK_IS_COMBO_BOX(widget)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
583 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
584 GtkTreeModel *store = gtk_combo_box_get_model(GTK_COMBO_BOX(widget)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
585 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
586 if(store) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
587 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
588 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
589 GtkTreePath *path; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
590 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
591 g_object_set_data(G_OBJECT(widget), "_dw_recursing", GINT_TO_POINTER(1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
592 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
593 if(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
594 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
595 path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
596 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
597 if(path) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
598 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
599 gint *indices = gtk_tree_path_get_indices(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
600 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
601 if(indices) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
602 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
603 int (*selectfunc)(HWND, int, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
604 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
605 retval = selectfunc(work.window, indices[0], work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
606 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
607 gtk_tree_path_free(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
608 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
609 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
610 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
611 g_object_set_data(G_OBJECT(widget), "_dw_recursing", NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
612 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
613 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
614 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
615 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
616 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
617 #define _DW_DATA_TYPE_STRING 0 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
618 #define _DW_DATA_TYPE_POINTER 1 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
619 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
620 static gint _tree_context_event(GtkWidget *widget, GdkEvent *event, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
621 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
622 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
623 int retval = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
624 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
625 if(work.window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
626 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
627 int button = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
628 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
629 if(button == 3) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
630 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
631 int (*contextfunc)(HWND, char *, int, int, void *, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
632 char *text = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
633 void *itemdata = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
634 /* TODO: Fill these in */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
635 int x = 0, y = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
636 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
637 if(widget && GTK_IS_TREE_VIEW(widget)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
638 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
639 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
640 GtkTreeModel *store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
641 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
642 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
643 if(sel && gtk_tree_selection_get_mode(sel) != GTK_SELECTION_MULTIPLE && |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
644 gtk_tree_selection_get_selected(sel, NULL, &iter)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
645 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
646 if(g_object_get_data(G_OBJECT(widget), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_TREE)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
647 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
648 gtk_tree_model_get(store, &iter, _DW_DATA_TYPE_STRING, &text, 2, &itemdata, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
649 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
650 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
651 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
652 gtk_tree_model_get(store, &iter, _DW_DATA_TYPE_STRING, &text, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
653 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
654 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
655 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
656 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
657 GtkTreePath *path; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
658 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
659 gtk_tree_view_get_cursor(GTK_TREE_VIEW(widget), &path, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
660 if(path) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
661 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
662 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
663 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
664 if(gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
665 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
666 if(g_object_get_data(G_OBJECT(widget), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_TREE)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
667 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
668 gtk_tree_model_get(store, &iter, _DW_DATA_TYPE_STRING, &text, 2, &itemdata, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
669 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
670 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
671 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
672 gtk_tree_model_get(store, &iter, _DW_DATA_TYPE_STRING, &text, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
673 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
674 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
675 gtk_tree_path_free(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
676 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
677 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
678 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
679 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
680 retval = contextfunc(work.window, text, x, y, work.data, itemdata); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
681 if(text) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
682 g_free(text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
683 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
684 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
685 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
686 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
687 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
688 static gint _tree_select_event(GtkTreeSelection *sel, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
689 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
690 GtkWidget *item = NULL, *widget = (GtkWidget *)gtk_tree_selection_get_tree_view(sel); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
691 int retval = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
692 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
693 if(widget) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
694 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
695 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
696 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
697 if(work.window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
698 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
699 int (*treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
700 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
701 char *text = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
702 void *itemdata = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
703 GtkTreeModel *store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
704 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
705 if(g_object_get_data(G_OBJECT(widget), "_dw_double_click")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
706 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
707 g_object_set_data(G_OBJECT(widget), "_dw_double_click", GINT_TO_POINTER(0)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
708 return TRUE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
709 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
710 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
711 if(gtk_tree_selection_get_mode(sel) != GTK_SELECTION_MULTIPLE && |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
712 gtk_tree_selection_get_selected(sel, NULL, &iter)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
713 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
714 if(g_object_get_data(G_OBJECT(widget), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_TREE)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
715 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
716 gtk_tree_model_get(store, &iter, _DW_DATA_TYPE_STRING, &text, 2, &itemdata, 3, &item, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
717 retval = treeselectfunc(work.window, (HTREEITEM)item, text, work.data, itemdata); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
718 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
719 else if(g_object_get_data(G_OBJECT(widget), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
720 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
721 gtk_tree_model_get(store, &iter, _DW_DATA_TYPE_STRING, &text, _DW_DATA_TYPE_POINTER, &itemdata, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
722 retval = treeselectfunc(work.window, (HTREEITEM)item, text, work.data, itemdata); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
723 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
724 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
725 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
726 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
727 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
728 if(path) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
729 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
730 gint *indices = gtk_tree_path_get_indices(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
731 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
732 if(indices) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
733 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
734 int (*selectfunc)(HWND, int, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
735 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
736 retval = selectfunc(work.window, indices[0], work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
737 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
738 gtk_tree_path_free(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
739 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
740 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
741 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
742 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
743 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
744 GtkTreePath *path; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
745 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
746 gtk_tree_view_get_cursor(GTK_TREE_VIEW(widget), &path, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
747 if(path) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
748 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
749 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
750 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
751 if(gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
752 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
753 if(g_object_get_data(G_OBJECT(widget), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_TREE)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
754 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
755 gtk_tree_model_get(store, &iter, _DW_DATA_TYPE_STRING, &text, 2, &itemdata, 3, &item, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
756 retval = treeselectfunc(work.window, (HTREEITEM)item, text, work.data, itemdata); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
757 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
758 else if(g_object_get_data(G_OBJECT(widget), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
759 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
760 gtk_tree_model_get(store, &iter, _DW_DATA_TYPE_STRING, &text, _DW_DATA_TYPE_POINTER, &itemdata, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
761 retval = treeselectfunc(work.window, (HTREEITEM)item, text, work.data, itemdata); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
762 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
763 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
764 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
765 gint *indices = gtk_tree_path_get_indices(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
766 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
767 if(indices) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
768 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
769 int (*selectfunc)(HWND, int, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
770 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
771 retval = selectfunc(work.window, indices[0], work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
772 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
773 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
774 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
775 gtk_tree_path_free(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
776 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
777 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
778 if(text) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
779 g_free(text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
780 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
781 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
782 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
783 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
784 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
785 static gint _tree_expand_event(GtkTreeView *widget, GtkTreeIter *iter, GtkTreePath *path, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
786 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
787 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
788 int retval = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
789 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
790 if(!_dw_ignore_expand && work.window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
791 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
792 int (*treeexpandfunc)(HWND, HTREEITEM, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
793 retval = treeexpandfunc(work.window, (HTREEITEM)iter, work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
794 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
795 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
796 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
797 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
798 static gint _container_enter_event(GtkWidget *widget, GdkEvent *event, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
799 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
800 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
801 int retval = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
802 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
803 if(work.window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
804 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
805 /* Handle both key and button events together */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
806 if(retval /* TODO: Fix this... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
807 (event->type == GDK_2BUTTON_PRESS && buttonevent->button == 1) || |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
808 (event->type == GDK_KEY_PRESS && keyevent->keyval == VK_RETURN)*/) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
809 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
810 int (*contextfunc)(HWND, char *, void *, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
811 char *text = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
812 void *data = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
813 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
814 /* Sanity check */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
815 if(GTK_IS_TREE_VIEW(widget)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
816 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
817 GtkTreePath *path; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
818 GtkTreeModel *store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
819 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
820 gtk_tree_view_get_cursor(GTK_TREE_VIEW(widget), &path, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
821 if(path) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
822 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
823 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
824 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
825 if(gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
826 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
827 if(g_object_get_data(G_OBJECT(widget), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
828 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
829 gtk_tree_model_get(store, &iter, _DW_DATA_TYPE_STRING, &text, _DW_DATA_TYPE_POINTER, &data, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
830 retval = contextfunc(work.window, text, work.data, data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
831 if(text) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
832 g_free(text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
833 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
834 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
835 gtk_tree_path_free(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
836 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
837 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
838 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
839 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
840 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
841 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
842 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
843 /* Return the logical page id from the physical page id */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
844 int _get_logical_page(HWND handle, unsigned long pageid) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
845 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
846 int z; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
847 GtkWidget **pagearray = g_object_get_data(G_OBJECT(handle), "_dw_pagearray"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
848 GtkWidget *thispage = gtk_notebook_get_nth_page(GTK_NOTEBOOK(handle), pageid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
849 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
850 if(pagearray && thispage) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
851 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
852 for(z=0;z<256;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
853 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
854 if(thispage == pagearray[z]) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
855 return z; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
856 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
857 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
858 return 256; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
859 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
860 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
861 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
862 static gint _switch_page_event(GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
863 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
864 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
865 int retval = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
866 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
867 if(work.window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
868 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
869 int (*switchpagefunc)(HWND, unsigned long, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
870 retval = switchpagefunc(work.window, _get_logical_page(GTK_WIDGET(notebook), page_num), work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
871 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
872 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
873 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
874 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
875 static gint _column_click_event(GtkWidget *widget, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
876 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
877 void **params = data; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
878 int retval = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
879 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
880 if(params && params[2]) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
881 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
882 GtkWidget *tree = (GtkWidget *)params[2]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
883 gint handlerdata = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(tree), "_dw_column_click_id")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
884 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
885 if(handlerdata) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
886 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
887 SignalHandler work; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
888 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
889 params[0] = GINT_TO_POINTER(handlerdata-1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
890 work = _get_signal_handler(params); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
891 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
892 if(work.window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
893 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
894 int column_num = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "_dw_column")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
895 int (*clickcolumnfunc)(HWND, int, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
896 retval = clickcolumnfunc(work.window, column_num, work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
897 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
898 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
899 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
900 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
901 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
902 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
903 static int _round_value(gfloat val) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
904 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
905 int newval = (int)val; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
906 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
907 if(val >= 0.5 + (gfloat)newval) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
908 newval++; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
909 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
910 return newval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
911 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
912 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
913 static gint _value_changed_event(GtkWidget *widget, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
914 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
915 GtkWidget *slider, *spinbutton, *scrollbar; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
916 GtkAdjustment *adjustment = (GtkAdjustment *)widget; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
917 int max, val; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
918 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
919 if(!GTK_IS_ADJUSTMENT(adjustment)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
920 adjustment = (GtkAdjustment *)g_object_get_data(G_OBJECT(widget), "_dw_adjustment"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
921 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
922 slider = (GtkWidget *)g_object_get_data(G_OBJECT(adjustment), "_dw_slider"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
923 spinbutton = (GtkWidget *)g_object_get_data(G_OBJECT(adjustment), "_dw_spinbutton"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
924 scrollbar = (GtkWidget *)g_object_get_data(G_OBJECT(adjustment), "_dw_scrollbar"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
925 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
926 max = _round_value(gtk_adjustment_get_upper(adjustment)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
927 val = _round_value(gtk_adjustment_get_value(adjustment)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
928 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
929 if(g_object_get_data(G_OBJECT(adjustment), "_dw_suppress_value_changed_event")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
930 return FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
931 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
932 if (slider || spinbutton || scrollbar) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
933 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
934 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
935 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
936 if (work.window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
937 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
938 int (*valuechangedfunc)(HWND, int, void *) = work.func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
939 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
940 if(slider && gtk_orientable_get_orientation(GTK_ORIENTABLE(slider)) == GTK_ORIENTATION_VERTICAL) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
941 valuechangedfunc(work.window, (max - val) - 1, work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
942 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
943 valuechangedfunc(work.window, val, work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
944 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
945 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
946 return FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
947 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
948 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
949 static gint _default_key_press_event(GtkWidget *widget, GdkEvent *event, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
950 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
951 GtkWidget *next = (GtkWidget *)data; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
952 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
953 if(next) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
954 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
955 if(0 /* TODO: Fix this: event->keyval == GDK_KEY_Return*/) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
956 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
957 if(GTK_IS_BUTTON(next)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
958 g_signal_emit_by_name(G_OBJECT(next), "clicked"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
959 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
960 gtk_widget_grab_focus(next); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
961 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
962 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
963 return FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
964 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
965 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
966 static GdkPixbuf *_dw_pixbuf_from_resource(unsigned int rid) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
967 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
968 char resource_path[201] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
969 snprintf(resource_path, 200, "/org/dbsoft/dwindows/resources/%u.png", rid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
970 return gdk_pixbuf_new_from_resource(resource_path, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
971 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
972 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
973 static GdkPixbuf *_find_pixbuf(HICN icon, unsigned long *userwidth, unsigned long *userheight) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
974 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
975 unsigned int id = GPOINTER_TO_INT(icon); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
976 GdkPixbuf *icon_pixbuf = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
977 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
978 /* Quick dropout for non-handle */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
979 if(!icon) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
980 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
981 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
982 if(id > 65535) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
983 icon_pixbuf = icon; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
984 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
985 icon_pixbuf = _dw_pixbuf_from_resource(id); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
986 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
987 if(userwidth) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
988 *userwidth = icon_pixbuf ? gdk_pixbuf_get_width(icon_pixbuf) : 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
989 if(userheight) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
990 *userheight = icon_pixbuf ? gdk_pixbuf_get_height(icon_pixbuf) : 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
991 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
992 return icon_pixbuf; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
993 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
994 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
995 /* Handle system notification click callbacks */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
996 static void _dw_notification_handler(GSimpleAction *action, GVariant *param, gpointer user_data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
997 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
998 char textbuf[101] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
999 int (*func)(HWND, void *); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1000 void *data; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1001 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1002 snprintf(textbuf, 100, "dw-notification-%llu-func", DW_POINTER_TO_ULONGLONG(g_variant_get_uint64(param))); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1003 func = g_object_get_data(G_OBJECT(_DWApp), textbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1004 g_object_set_data(G_OBJECT(_DWApp), textbuf, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1005 snprintf(textbuf, 100, "dw-notification-%llu-data", DW_POINTER_TO_ULONGLONG(g_variant_get_uint64(param))); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1006 data = g_object_get_data(G_OBJECT(_DWApp), textbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1007 g_object_set_data(G_OBJECT(_DWApp), textbuf, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1008 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1009 if(func) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1010 func((HWND)DW_ULONGLONG_TO_POINTER(g_variant_get_uint64(param)), data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1011 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1012 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1013 static void _dw_app_activate(GApplication *app, gpointer user_data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1014 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1015 /* Not sure why this signal is required, but GLib gives warnings |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1016 * when this signal is not connected, so putting this here to |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1017 * quell the warning and can be used at a later point if needed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1018 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1019 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1020 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1021 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1022 * Initializes the Dynamic Windows engine. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1023 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1024 * newthread: True if this is the only thread. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1025 * False if there is already a message loop running. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1026 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1027 int dw_init(int newthread, int argc, char *argv[]) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1028 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1029 /* Setup the private data directory */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1030 if(argc > 0 && argv[0]) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1031 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1032 char *pathcopy = strdup(argv[0]); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1033 char *pos = strrchr(pathcopy, '/'); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1034 char *binname = pathcopy; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1035 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1036 /* If we have a / then... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1037 * the binary name should be at the end. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1038 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1039 if(pos) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1040 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1041 binname = pos + 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1042 *pos = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1043 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1044 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1045 if(*binname) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1046 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1047 char *binpos = strstr(pathcopy, "/bin"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1048 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1049 if(binpos) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1050 strncpy(_dw_share_path, pathcopy, (size_t)(binpos - pathcopy)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1051 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1052 strcpy(_dw_share_path, "/usr/local"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1053 strcat(_dw_share_path, "/share/"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1054 strcat(_dw_share_path, binname); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1055 if(!_dw_app_id[0]) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1056 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1057 /* If we have a binary name, use that for the Application ID instead. */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1058 snprintf(_dw_app_id, _DW_APP_ID_SIZE, "%s.%s", DW_APP_DOMAIN_DEFAULT, binname); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1059 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1060 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1061 if(pathcopy) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1062 free(pathcopy); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1063 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1064 /* If that failed... just get the current directory */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1065 if(!_dw_share_path[0] && !getcwd(_dw_share_path, PATH_MAX)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1066 _dw_share_path[0] = '/'; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1067 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1068 gtk_init(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1069 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1070 pthread_key_create(&_dw_fg_color_key, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1071 pthread_key_create(&_dw_bg_color_key, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1072 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1073 _dw_init_thread(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1074 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1075 /* Create a global object for glib activities */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1076 _DWObject = g_object_new(G_TYPE_OBJECT, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1077 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1078 if(!_dw_app_id[0]) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1079 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1080 /* Generate an Application ID based on the PID if all else fails. */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1081 snprintf(_dw_app_id, _DW_APP_ID_SIZE, "%s.pid.%d", DW_APP_DOMAIN_DEFAULT, (int)getpid()); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1082 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1083 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1084 /* Initialize the application subsystem on supported versions... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1085 * we generate an application ID based on the binary name or PID |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1086 * instead of passing NULL to enable full application support. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1087 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1088 _DWApp = g_application_new(_dw_app_id, G_APPLICATION_FLAGS_NONE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1089 if(_DWApp && g_application_register(_DWApp, NULL, NULL)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1090 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1091 /* Creat our notification handler for any notifications */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1092 GSimpleAction *action = g_simple_action_new("notification", G_VARIANT_TYPE_UINT64); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1093 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1094 g_signal_connect(G_OBJECT(action), "activate", G_CALLBACK(_dw_notification_handler), NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1095 g_action_map_add_action(G_ACTION_MAP(_DWApp), G_ACTION(action)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1096 g_signal_connect(_DWApp, "activate", G_CALLBACK(_dw_app_activate), NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1097 g_application_activate(_DWApp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1098 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1099 return TRUE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1100 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1101 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1102 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1103 * Runs a message loop for Dynamic Windows. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1104 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1105 void API dw_main(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1106 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1107 gtk_main(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1108 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1109 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1110 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1111 * Causes running dw_main() to return. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1112 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1113 void API dw_main_quit(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1114 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1115 gtk_main_quit(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1116 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1117 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1118 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1119 * Runs a message loop for Dynamic Windows, for a period of milliseconds. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1120 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1121 * milliseconds: Number of milliseconds to run the loop for. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1122 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1123 void API dw_main_sleep(int milliseconds) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1124 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1125 struct timeval tv, start; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1126 pthread_t curr = pthread_self(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1127 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1128 gettimeofday(&start, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1129 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1130 if(_dw_thread == (pthread_t)-1 || _dw_thread == curr) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1131 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1132 pthread_t orig = _dw_thread; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1133 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1134 gettimeofday(&tv, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1135 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1136 while(((tv.tv_sec - start.tv_sec)*1000) + ((tv.tv_usec - start.tv_usec)/1000) <= milliseconds) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1137 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1138 if(orig == (pthread_t)-1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1139 _dw_thread = curr; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1140 if(curr == _dw_thread && gtk_events_pending()) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1141 gtk_main_iteration(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1142 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1143 _dw_msleep(1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1144 if(orig == (pthread_t)-1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1145 _dw_thread = orig; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1146 gettimeofday(&tv, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1147 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1148 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1149 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1150 _dw_msleep(milliseconds); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1151 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1152 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1153 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1154 * Processes a single message iteration and returns. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1155 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1156 void API dw_main_iteration(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1157 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1158 pthread_t orig = _dw_thread; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1159 pthread_t curr = pthread_self(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1160 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1161 if(_dw_thread == (pthread_t)-1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1162 _dw_thread = curr; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1163 if(curr == _dw_thread && gtk_events_pending()) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1164 gtk_main_iteration(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1165 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1166 sched_yield(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1167 if(orig == (pthread_t)-1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1168 _dw_thread = orig; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1169 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1170 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1171 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1172 * Free's memory allocated by dynamic windows. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1173 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1174 * ptr: Pointer to dynamic windows allocated |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1175 * memory to be free()'d. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1176 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1177 void dw_free(void *ptr) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1178 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1179 free(ptr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1180 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1181 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1182 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1183 * Allocates and initializes a dialog struct. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1184 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1185 * data: User defined data to be passed to functions. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1186 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1187 DWDialog *dw_dialog_new(void *data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1188 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1189 DWDialog *tmp = malloc(sizeof(DWDialog)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1190 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1191 if ( tmp ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1192 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1193 tmp->eve = dw_event_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1194 dw_event_reset(tmp->eve); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1195 tmp->data = data; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1196 tmp->done = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1197 tmp->method = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1198 tmp->result = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1199 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1200 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1201 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1202 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1203 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1204 * Accepts a dialog struct and returns the given data to the |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1205 * initial called of dw_dialog_wait(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1206 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1207 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1208 * result: Data to be returned by dw_dialog_wait(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1209 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1210 int dw_dialog_dismiss(DWDialog *dialog, void *result) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1211 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1212 dialog->result = result; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1213 if(dialog->method) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1214 gtk_main_quit(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1215 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1216 dw_event_post(dialog->eve); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1217 dialog->done = TRUE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1218 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1219 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1220 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1221 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1222 * Accepts a dialog struct waits for dw_dialog_dismiss() to be |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1223 * called by a signal handler with the given dialog struct. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1224 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1225 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1226 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1227 void *dw_dialog_wait(DWDialog *dialog) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1228 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1229 void *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1230 int newprocess = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1231 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1232 if(!dialog) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1233 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1234 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1235 /* _dw_thread will be -1 if dw_main hasn't been run yet. */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1236 if(_dw_thread == (pthread_t)-1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1237 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1238 _dw_thread = pthread_self(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1239 newprocess = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1240 _dw_gdk_threads_enter(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1241 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1242 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1243 if(pthread_self() == _dw_thread) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1244 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1245 dialog->method = TRUE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1246 gtk_main(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1247 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1248 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1249 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1250 dialog->method = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1251 dw_event_wait(dialog->eve, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1252 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1253 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1254 if(newprocess) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1255 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1256 _dw_thread = (pthread_t)-1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1257 _dw_gdk_threads_leave(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1258 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1259 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1260 dw_event_close(&dialog->eve); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1261 tmp = dialog->result; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1262 free(dialog); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1263 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1264 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1265 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1266 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1267 * Displays a debug message on the console... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1268 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1269 * format: printf style format string. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1270 * ...: Additional variables for use in the format. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1271 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1272 void API dw_debug(const char *format, ...) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1273 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1274 va_list args; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1275 char outbuf[1025] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1276 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1277 va_start(args, format); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1278 vsnprintf(outbuf, 1024, format, args); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1279 va_end(args); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1280 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1281 fprintf(stderr, "%s", outbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1282 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1283 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1284 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1285 * Displays a Message Box with given text and title.. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1286 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1287 * title: The title of the message box. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1288 * flags: Defines buttons and icons to display |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1289 * format: printf style format string. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1290 * ...: Additional variables for use in the format. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1291 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1292 int dw_messagebox(const char *title, int flags, const char *format, ...) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1293 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1294 GtkMessageType gtkicon = GTK_MESSAGE_OTHER; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1295 GtkButtonsType gtkbuttons = GTK_BUTTONS_OK; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1296 GtkWidget *dialog; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1297 int response; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1298 va_list args; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1299 char outbuf[1025] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1300 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1301 va_start(args, format); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1302 vsnprintf(outbuf, 1024, format, args); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1303 va_end(args); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1304 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1305 if(flags & DW_MB_ERROR) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1306 gtkicon = GTK_MESSAGE_ERROR; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1307 else if(flags & DW_MB_WARNING) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1308 gtkicon = GTK_MESSAGE_WARNING; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1309 else if(flags & DW_MB_INFORMATION) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1310 gtkicon = GTK_MESSAGE_INFO; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1311 else if(flags & DW_MB_QUESTION) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1312 gtkicon = GTK_MESSAGE_QUESTION; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1313 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1314 if(flags & DW_MB_OKCANCEL) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1315 gtkbuttons = GTK_BUTTONS_OK_CANCEL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1316 else if(flags & (DW_MB_YESNO | DW_MB_YESNOCANCEL)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1317 gtkbuttons = GTK_BUTTONS_YES_NO; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1318 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1319 dialog = gtk_message_dialog_new(NULL, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1320 GTK_DIALOG_USE_HEADER_BAR | |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1321 GTK_DIALOG_MODAL, gtkicon, gtkbuttons, "%s", title); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1322 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), "%s", outbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1323 if(flags & DW_MB_YESNOCANCEL) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1324 gtk_dialog_add_button(GTK_DIALOG(dialog), "Cancel", GTK_RESPONSE_CANCEL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1325 response = gtk_dialog_run(GTK_DIALOG(dialog)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1326 gtk_widget_destroy(dialog); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1327 switch(response) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1328 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1329 case GTK_RESPONSE_OK: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1330 return DW_MB_RETURN_OK; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1331 case GTK_RESPONSE_CANCEL: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1332 return DW_MB_RETURN_CANCEL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1333 case GTK_RESPONSE_YES: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1334 return DW_MB_RETURN_YES; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1335 case GTK_RESPONSE_NO: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1336 return DW_MB_RETURN_NO; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1337 default: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1338 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1339 /* Handle the destruction of the dialog result */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1340 if(flags & (DW_MB_OKCANCEL | DW_MB_YESNOCANCEL)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1341 return DW_MB_RETURN_CANCEL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1342 else if(flags & DW_MB_YESNO) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1343 return DW_MB_RETURN_NO; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1344 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1345 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1346 return DW_MB_RETURN_OK; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1347 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1348 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1349 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1350 * Minimizes or Iconifies a top-level window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1351 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1352 * handle: The window handle to minimize. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1353 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1354 int dw_window_minimize(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1355 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1356 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1357 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1358 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1359 gtk_window_iconify( GTK_WINDOW(handle) ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1360 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1361 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1362 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1363 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1364 * Makes the window topmost. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1365 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1366 * handle: The window handle to make topmost. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1367 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1368 int dw_window_raise(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1369 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1370 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1371 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1372 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1373 gdk_window_raise(gtk_widget_get_window(GTK_WIDGET(handle))); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1374 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1375 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1376 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1377 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1378 * Makes the window bottommost. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1379 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1380 * handle: The window handle to make bottommost. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1381 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1382 int dw_window_lower(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1383 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1384 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1385 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1386 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1387 gdk_window_lower(gtk_widget_get_window(GTK_WIDGET(handle))); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1388 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1389 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1390 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1391 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1392 * Makes the window visible. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1393 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1394 * handle: The window handle to make visible. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1395 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1396 int dw_window_show(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1397 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1398 GtkWidget *defaultitem; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1399 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1400 if (!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1401 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1402 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1403 gtk_widget_show(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1404 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1405 GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(handle)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1406 if (window && gtk_widget_get_mapped(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1407 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1408 int width = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_width")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1409 int height = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_height")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1410 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1411 /* If we had a size request before shown */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1412 if (width || height) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1413 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1414 /* Call the size function again now that we are realized */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1415 dw_window_set_size(handle, width, height); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1416 /* Clear out the data so we don't do it again */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1417 g_object_set_data(G_OBJECT(handle), "_dw_width", NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1418 g_object_set_data(G_OBJECT(handle), "_dw_height", NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1419 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1420 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1421 /* If we had a position request before shown */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1422 if (g_object_get_data(G_OBJECT(handle), "_dw_pos")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1423 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1424 int x = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_x")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1425 int y = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_y")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1426 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1427 /* Call the position function again now that we are realized */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1428 dw_window_set_pos(handle, x, y); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1429 /* Clear out the data so we don't do it again */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1430 g_object_set_data(G_OBJECT(handle), "_dw_pos", NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1431 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1432 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1433 gdk_window_raise(window); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1434 gdk_display_flush(gdk_display_get_default()); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1435 gdk_window_show(window); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1436 gdk_display_flush(gdk_display_get_default()); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1437 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1438 defaultitem = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_defaultitem"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1439 if (defaultitem) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1440 gtk_widget_grab_focus(defaultitem); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1441 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1442 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1443 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1444 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1445 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1446 * Makes the window invisible. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1447 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1448 * handle: The window handle to make visible. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1449 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1450 int dw_window_hide(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1451 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1452 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1453 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1454 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1455 gtk_widget_hide(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1456 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1457 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1458 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1459 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1460 * Destroys a window and all of it's children. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1461 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1462 * handle: The window handle to destroy. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1463 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1464 int dw_window_destroy(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1465 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1466 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1467 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1468 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1469 if(GTK_IS_WIDGET(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1470 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1471 GtkWidget *box, *handle2 = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1472 GtkWidget *eventbox = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_eventbox"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1473 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1474 /* Handle the invisible event box if it exists */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1475 if(eventbox && GTK_IS_WIDGET(eventbox)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1476 handle2 = eventbox; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1477 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1478 /* Check if we are removing a widget from a box */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1479 if((box = gtk_widget_get_parent(handle2)) && GTK_IS_GRID(box)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1480 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1481 /* Get the number of items in the box... */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1482 int boxcount = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(box), "_dw_boxcount")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1483 int boxtype = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(box), "_dw_boxtype")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1484 int z; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1485 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1486 /* Figure out where in the grid this widget is and remove that row/column */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1487 if(boxtype == DW_VERT) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1488 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1489 for(z=0;z<boxcount;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1490 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1491 if(gtk_grid_get_child_at(GTK_GRID(box), 0, z) == handle2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1492 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1493 gtk_grid_remove_row(GTK_GRID(box), z); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1494 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1495 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1496 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1497 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1498 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1499 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1500 for(z=0;z<boxcount;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1501 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1502 if(gtk_grid_get_child_at(GTK_GRID(box), z, 0) == handle2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1503 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1504 gtk_grid_remove_column(GTK_GRID(box), z); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1505 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1506 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1507 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1508 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1509 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1510 if(boxcount > 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1511 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1512 /* Decrease the count by 1 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1513 boxcount--; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1514 g_object_set_data(G_OBJECT(box), "_dw_boxcount", GINT_TO_POINTER(boxcount)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1515 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1516 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1517 /* Finally destroy the widget, make sure it is still |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1518 * a valid widget if it got removed from the grid. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1519 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1520 if(GTK_IS_WIDGET(handle2)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1521 gtk_widget_destroy(handle2); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1522 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1523 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1524 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1525 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1526 /* Causes entire window to be invalidated and redrawn. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1527 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1528 * handle: Toplevel window handle to be redrawn. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1529 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1530 void dw_window_redraw(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1531 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1532 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1533 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1534 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1535 * Changes a window's parent to newparent. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1536 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1537 * handle: The window handle to destroy. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1538 * newparent: The window's new parent window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1539 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1540 void dw_window_reparent(HWND handle, HWND newparent) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1541 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1542 gdk_window_reparent(gtk_widget_get_window(GTK_WIDGET(handle)), newparent ? gtk_widget_get_window(GTK_WIDGET(newparent)) : gdk_get_default_root_window(), 0, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1543 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1544 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1545 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1546 * Sets the default font used on text based widgets. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1547 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1548 * fontname: Font name in Dynamic Windows format. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1549 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1550 void API dw_font_set_default(const char *fontname) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1551 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1552 char *oldfont = _DWDefaultFont; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1553 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1554 _DWDefaultFont = strdup(fontname); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1555 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1556 if(oldfont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1557 free(oldfont); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1558 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1559 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1560 /* Convert DW style font to CSS syntax (or Pango for older versions): |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1561 * font: font-style font-variant font-weight font-size/line-height font-family |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1562 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1563 char *_convert_font(const char *font) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1564 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1565 char *newfont = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1566 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1567 if(font) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1568 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1569 char *name = strchr(font, '.'); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1570 #if GTK_CHECK_VERSION(3,20,0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1571 char *Italic = strstr(font, " Italic"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1572 char *Bold = strstr(font, " Bold"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1573 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1574 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1575 /* Detect Dynamic Windows style font name... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1576 * Format: ##.Fontname |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1577 * and convert to CSS or Pango syntax |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1578 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1579 if(name && (name++) && isdigit(*font)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1580 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1581 int size = atoi(font); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1582 #if GTK_CHECK_VERSION(3,20,0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1583 int len = (Italic ? (Bold ? (Italic > Bold ? (Bold - name) : (Italic - name)) : (Italic - name)) : (Bold ? (Bold - name) : strlen(name))); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1584 char *newname = alloca(len+1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1585 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1586 memset(newname, 0, len+1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1587 strncpy(newname, name, len); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1588 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1589 newfont = g_strdup_printf("%s normal %s %dpx \"%s\"", Italic ? "italic" : "normal", |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1590 Bold ? "bold" : "normal", size, newname); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1591 #else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1592 newfont = g_strdup_printf("%s %d", name, size); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1593 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1594 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1595 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1596 return newfont; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1597 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1598 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1599 /* Internal functions to convert to GTK3 style CSS */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1600 static void _dw_override_color(GtkWidget *widget, const char *element, GdkRGBA *color) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1601 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1602 gchar *dataname = g_strdup_printf ("_dw_color_%s", element); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1603 GtkCssProvider *provider = g_object_get_data(G_OBJECT(widget), dataname); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1604 GtkStyleContext *scontext = gtk_widget_get_style_context(widget); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1605 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1606 /* If we have an old context from a previous override remove it */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1607 if(provider) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1608 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1609 gtk_style_context_remove_provider(scontext, GTK_STYLE_PROVIDER(provider)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1610 g_object_unref(provider); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1611 provider = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1612 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1613 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1614 /* If we have a new color, create a new provider and add it */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1615 if(color) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1616 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1617 gchar *scolor = gdk_rgba_to_string(color); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1618 gchar *css = g_strdup_printf ("* { %s: %s; }", element, scolor); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1619 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1620 provider = gtk_css_provider_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1621 g_free(scolor); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1622 gtk_css_provider_load_from_data(provider, css, -1, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1623 g_free(css); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1624 gtk_style_context_add_provider(scontext, GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1625 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1626 g_object_set_data(G_OBJECT(widget), dataname, (gpointer)provider); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1627 g_free(dataname); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1628 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1629 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1630 static void _dw_override_font(GtkWidget *widget, const char *font) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1631 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1632 GtkCssProvider *provider = g_object_get_data(G_OBJECT(widget), "_dw_font"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1633 GtkStyleContext *scontext = gtk_widget_get_style_context(widget); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1634 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1635 /* If we have an old context from a previous override remove it */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1636 if(provider) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1637 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1638 gtk_style_context_remove_provider(scontext, GTK_STYLE_PROVIDER(provider)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1639 g_object_unref(provider); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1640 provider = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1641 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1642 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1643 /* If we have a new font, create a new provider and add it */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1644 if(font) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1645 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1646 gchar *css = g_strdup_printf ("* { font: %s; }", font); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1647 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1648 provider = gtk_css_provider_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1649 gtk_css_provider_load_from_data(provider, css, -1, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1650 g_free(css); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1651 gtk_style_context_add_provider(scontext, GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1652 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1653 g_object_set_data(G_OBJECT(widget), "_dw_font", (gpointer)provider); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1654 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1655 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1656 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1657 * Sets the font used by a specified window (widget) handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1658 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1659 * handle: The window (widget) handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1660 * fontname: Name and size of the font in the form "size.fontname" |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1661 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1662 int dw_window_set_font(HWND handle, const char *fontname) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1663 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1664 GtkWidget *handle2 = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1665 char *font = _convert_font(fontname); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1666 gpointer data; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1667 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1668 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1669 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1670 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1671 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1672 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1673 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1674 /* If it is a groupox we want to operate on the frame label */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1675 else if(GTK_IS_FRAME(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1676 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1677 GtkWidget *tmp = gtk_frame_get_label_widget(GTK_FRAME(handle)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1678 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1679 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1680 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1681 else if(GTK_IS_COMBO_BOX(handle) || GTK_IS_BUTTON(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1682 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1683 GtkWidget *tmp = gtk_bin_get_child(GTK_BIN(handle)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1684 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1685 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1686 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1687 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1688 /* Free old font name if one is allocated */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1689 data = g_object_get_data(G_OBJECT(handle2), "_dw_fontname"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1690 g_object_set_data(G_OBJECT(handle2), "_dw_fontname", (gpointer)font); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1691 if(data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1692 free(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1693 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1694 _dw_override_font(handle2, font); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1695 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1696 return TRUE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1697 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1698 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1699 /* Allows the user to choose a font using the system's font chooser dialog. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1700 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1701 * currfont: current font |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1702 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1703 * A malloced buffer with the selected font or NULL on error. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1704 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1705 char * API dw_font_choose(const char *currfont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1706 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1707 GtkFontChooser *fd; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1708 char *font = currfont ? strdup(currfont) : NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1709 char *name = font ? strchr(font, '.') : NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1710 char *retfont = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1711 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1712 /* Detect Dynamic Windows style font name... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1713 * Format: ##.Fontname |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1714 * and convert to a Pango name |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1715 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1716 if(name && isdigit(*font)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1717 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1718 int size = atoi(font); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1719 *name = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1720 name++; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1721 sprintf(font, "%s %d", name, size); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1722 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1723 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1724 fd = (GtkFontChooser *)gtk_font_chooser_dialog_new("Choose font", NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1725 if(font) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1726 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1727 gtk_font_chooser_set_font(fd, font); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1728 free(font); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1729 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1730 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1731 gtk_widget_show(GTK_WIDGET(fd)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1732 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1733 if(gtk_dialog_run(GTK_DIALOG(fd)) == GTK_RESPONSE_OK) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1734 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1735 char *fontname = gtk_font_chooser_get_font(fd); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1736 if(fontname && (retfont = strdup(fontname))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1737 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1738 int len = strlen(fontname); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1739 /* Convert to Dynamic Windows format if we can... */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1740 if(len > 0 && isdigit(fontname[len-1])) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1741 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1742 int size, x=len-1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1743 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1744 while(x > 0 && fontname[x] != ' ') |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1745 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1746 x--; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1747 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1748 size = atoi(&fontname[x]); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1749 /* If we were able to find a valid size... */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1750 if(size > 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1751 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1752 /* Null terminate after the name... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1753 * and create the Dynamic Windows style font. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1754 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1755 fontname[x] = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1756 snprintf(retfont, len+1, "%d.%s", size, fontname); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1757 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1758 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1759 g_free(fontname); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1760 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1761 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1762 gtk_widget_destroy(GTK_WIDGET(fd)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1763 return retfont; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1764 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1765 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1766 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1767 * Gets the font used by a specified window (widget) handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1768 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1769 * handle: The window (widget) handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1770 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1771 char *dw_window_get_font(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1772 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1773 PangoFontDescription *pfont; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1774 PangoContext *pcontext; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1775 GtkWidget *handle2 = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1776 char *font; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1777 char *retfont=NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1778 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1779 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1780 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1781 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1782 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1783 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1784 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1785 /* If it is a groupox we want to operate on the frame label */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1786 else if(GTK_IS_FRAME(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1787 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1788 GtkWidget *tmp = gtk_frame_get_label_widget(GTK_FRAME(handle)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1789 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1790 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1791 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1792 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1793 pcontext = gtk_widget_get_pango_context( handle2 ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1794 if ( pcontext ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1795 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1796 pfont = pango_context_get_font_description( pcontext ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1797 if ( pfont ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1798 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1799 int len, x; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1800 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1801 font = pango_font_description_to_string( pfont ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1802 retfont = strdup(font); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1803 len = strlen(font); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1804 /* Convert to Dynamic Windows format if we can... */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1805 if(len > 0 && isdigit(font[len-1])) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1806 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1807 int size; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1808 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1809 x=len-1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1810 while(x > 0 && font[x] != ' ') |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1811 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1812 x--; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1813 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1814 size = atoi(&font[x]); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1815 /* If we were able to find a valid size... */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1816 if(size > 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1817 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1818 /* Null terminate after the name... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1819 * and create the Dynamic Windows style font. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1820 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1821 font[x] = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1822 snprintf(retfont, len+1, "%d.%s", size, font); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1823 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1824 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1825 g_free( font ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1826 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1827 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1828 return retfont; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1829 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1830 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1831 void _free_gdk_colors(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1832 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1833 GdkRGBA *old = (GdkRGBA *)g_object_get_data(G_OBJECT(handle), "_dw_foregdk"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1834 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1835 if(old) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1836 free(old); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1837 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1838 old = (GdkRGBA *)g_object_get_data(G_OBJECT(handle), "_dw_backgdk"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1839 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1840 if(old) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1841 free(old); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1842 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1843 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1844 /* Free old color pointers and allocate new ones */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1845 static void _save_gdk_colors(HWND handle, GdkRGBA fore, GdkRGBA back) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1846 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1847 GdkRGBA *foregdk = malloc(sizeof(GdkRGBA)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1848 GdkRGBA *backgdk = malloc(sizeof(GdkRGBA)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1849 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1850 _free_gdk_colors(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1851 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1852 *foregdk = fore; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1853 *backgdk = back; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1854 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1855 g_object_set_data(G_OBJECT(handle), "_dw_foregdk", (gpointer)foregdk); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1856 g_object_set_data(G_OBJECT(handle), "_dw_backgdk", (gpointer)backgdk); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1857 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1858 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1859 static int _set_color(HWND handle, unsigned long fore, unsigned long back) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1860 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1861 /* Remember that each color component in X11 use 16 bit no matter |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1862 * what the destination display supports. (and thus GDK) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1863 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1864 GdkRGBA forecolor = {0}, backcolor = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1865 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1866 if(fore & DW_RGB_COLOR) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1867 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1868 forecolor.alpha = 1.0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1869 forecolor.red = (gdouble)DW_RED_VALUE(fore) / 255.0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1870 forecolor.green = (gdouble)DW_GREEN_VALUE(fore) / 255.0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1871 forecolor.blue = (gdouble)DW_BLUE_VALUE(fore) / 255.0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1872 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1873 else if(fore != DW_CLR_DEFAULT) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1874 forecolor = _colors[fore]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1875 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1876 _dw_override_color(handle, "color", fore != DW_CLR_DEFAULT ? &forecolor : NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1877 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1878 if(back & DW_RGB_COLOR) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1879 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1880 backcolor.alpha = 1.0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1881 backcolor.red = (gdouble)DW_RED_VALUE(back) / 255.0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1882 backcolor.green = (gdouble)DW_GREEN_VALUE(back) / 255.0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1883 backcolor.blue = (gdouble)DW_BLUE_VALUE(back) / 255.0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1884 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1885 else if(back != DW_CLR_DEFAULT) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1886 backcolor = _colors[back]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1887 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1888 _dw_override_color(handle, "background-color", back != DW_CLR_DEFAULT ? &backcolor : NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1889 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1890 _save_gdk_colors(handle, forecolor, backcolor); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1891 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1892 return TRUE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1893 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1894 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1895 * Sets the colors used by a specified window (widget) handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1896 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1897 * handle: The window (widget) handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1898 * fore: Foreground color in RGB format. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1899 * back: Background color in RGB format. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1900 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1901 int dw_window_set_color(HWND handle, unsigned long fore, unsigned long back) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1902 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1903 GtkWidget *handle2 = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1904 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1905 if(GTK_IS_SCROLLED_WINDOW(handle) || GTK_IS_BOX(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1906 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1907 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1908 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1909 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1910 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1911 else if(GTK_IS_GRID(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1912 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1913 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_eventbox"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1914 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1915 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1916 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1917 fore = DW_CLR_DEFAULT; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1918 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1919 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1920 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1921 _set_color(handle2, fore, back); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1922 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1923 return TRUE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1924 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1925 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1926 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1927 * Sets the font used by a specified window (widget) handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1928 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1929 * handle: The window (widget) handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1930 * border: Size of the window border in pixels. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1931 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1932 int dw_window_set_border(HWND handle, int border) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1933 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1934 /* TODO */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1935 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1936 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1937 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1938 #if GTK_CHECK_VERSION(3,20,0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1939 static GdkSeat *_dw_grab_seat = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1940 #else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1941 static GdkDeviceManager *_dw_grab_manager = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1942 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1943 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1944 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1945 * Captures the mouse input to this window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1946 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1947 * handle: Handle to receive mouse input. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1948 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1949 void dw_window_capture(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1950 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1951 _dw_grab_seat = gdk_display_get_default_seat(gtk_widget_get_display(handle)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1952 gdk_seat_grab (_dw_grab_seat, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1953 gtk_widget_get_window(handle), |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1954 GDK_SEAT_CAPABILITY_ALL_POINTING, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1955 FALSE, NULL, NULL, NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1956 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1957 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1958 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1959 * Changes the appearance of the mouse pointer. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1960 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1961 * handle: Handle to widget for which to change. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1962 * cursortype: ID of the pointer you want. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1963 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1964 void dw_window_set_pointer(HWND handle, int pointertype) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1965 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1966 GdkCursor *cursor; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1967 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1968 if(pointertype > 65535) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1969 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1970 GdkPixbuf *pixbuf = _find_pixbuf(GINT_TO_POINTER(pointertype), NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1971 cursor = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), pixbuf, 8, 8); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1972 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1973 else if(!pointertype) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1974 cursor = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1975 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1976 cursor = gdk_cursor_new_for_display(gdk_display_get_default(), pointertype); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1977 if(handle && gtk_widget_get_window(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1978 gdk_window_set_cursor(gtk_widget_get_window(handle), cursor); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1979 if(cursor) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1980 g_object_unref(cursor); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1981 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1982 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1983 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1984 * Releases previous mouse capture. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1985 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1986 void dw_window_release(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1987 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1988 if(_dw_grab_seat) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1989 gdk_seat_ungrab(_dw_grab_seat); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1990 _dw_grab_seat = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1991 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1992 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1993 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1994 * Create a new Window Frame. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1995 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1996 * owner: The Owner's window handle or HWND_DESKTOP. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1997 * title: The Window title. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1998 * flStyle: Style flags, see the PM reference. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1999 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2000 HWND dw_window_new(HWND hwndOwner, const char *title, unsigned long flStyle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2001 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2002 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2003 int flags = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2004 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2005 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2006 GtkWidget *box = dw_box_new(DW_VERT, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2007 GtkWidget *grid = gtk_grid_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2008 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2009 gtk_widget_show_all(grid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2010 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2011 last_window = tmp = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2012 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2013 gtk_window_set_title(GTK_WINDOW(tmp), title); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2014 gtk_window_set_resizable(GTK_WINDOW(tmp), (flStyle & DW_FCF_SIZEBORDER) ? TRUE : FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2015 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2016 gtk_widget_realize(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2017 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2018 if(flStyle & DW_FCF_TITLEBAR) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2019 flags |= GDK_DECOR_TITLE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2020 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2021 if(flStyle & DW_FCF_MINMAX) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2022 flags |= GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2023 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2024 if(flStyle & DW_FCF_SIZEBORDER) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2025 flags |= GDK_DECOR_RESIZEH | GDK_DECOR_BORDER; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2026 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2027 if(flStyle & (DW_FCF_BORDER | DW_FCF_DLGBORDER)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2028 flags |= GDK_DECOR_BORDER; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2029 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2030 if(flStyle & DW_FCF_FULLSCREEN) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2031 gtk_window_fullscreen(GTK_WINDOW(tmp)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2032 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2033 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2034 if(flStyle & DW_FCF_MAXIMIZE) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2035 gtk_window_maximize(GTK_WINDOW(tmp)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2036 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2037 if(flStyle & DW_FCF_MINIMIZE) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2038 gtk_window_iconify(GTK_WINDOW(tmp)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2039 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2040 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2041 /* Either the CLOSEBUTTON or SYSMENU flags should make it deletable */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2042 gtk_window_set_deletable(GTK_WINDOW(tmp), (flStyle & (DW_FCF_CLOSEBUTTON | DW_FCF_SYSMENU)) ? TRUE : FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2043 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2044 gdk_window_set_decorations(gtk_widget_get_window(tmp), flags); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2045 if(!flags) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2046 gtk_window_set_decorated(GTK_WINDOW(tmp), FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2047 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2048 if(hwndOwner) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2049 gdk_window_reparent(gtk_widget_get_window(GTK_WIDGET(tmp)), gtk_widget_get_window(GTK_WIDGET(hwndOwner)), 0, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2050 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2051 if(flStyle & DW_FCF_SIZEBORDER) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2052 g_object_set_data(G_OBJECT(tmp), "_dw_size", GINT_TO_POINTER(1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2053 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2054 gtk_grid_attach(GTK_GRID(grid), box, 0, 1, 1, 1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2055 gtk_container_add(GTK_CONTAINER(tmp), grid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2056 g_object_set_data(G_OBJECT(tmp), "_dw_boxhandle", (gpointer)box); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2057 g_object_set_data(G_OBJECT(tmp), "_dw_grid", (gpointer)grid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2058 gtk_widget_add_events(GTK_WIDGET(tmp), GDK_PROPERTY_CHANGE_MASK); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2059 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2060 g_object_set_data(G_OBJECT(tmp), "_dw_style", GINT_TO_POINTER(flStyle)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2061 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2062 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2063 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2064 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2065 * Create a new Box to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2066 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2067 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2068 * pad: Number of pixels to pad around the box. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2069 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2070 HWND dw_box_new(int type, int pad) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2071 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2072 GtkWidget *tmp, *eventbox; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2073 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2074 tmp = gtk_grid_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2075 eventbox = gtk_event_box_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2076 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2077 gtk_widget_show(eventbox); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2078 g_object_set_data(G_OBJECT(tmp), "_dw_eventbox", (gpointer)eventbox); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2079 g_object_set_data(G_OBJECT(tmp), "_dw_boxtype", GINT_TO_POINTER(type)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2080 g_object_set_data(G_OBJECT(tmp), "_dw_boxpad", GINT_TO_POINTER(pad)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2081 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2082 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2083 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2084 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2085 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2086 * Create a new scrollable Box to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2087 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2088 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2089 * pad: Number of pixels to pad around the box. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2090 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2091 HWND dw_scrollbox_new( int type, int pad ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2092 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2093 GtkWidget *tmp, *box, *eventbox; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2094 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2095 tmp = gtk_scrolled_window_new(NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2096 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (tmp), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2097 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2098 box = gtk_grid_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2099 eventbox = gtk_event_box_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2100 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2101 gtk_widget_show(eventbox); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2102 g_object_set_data(G_OBJECT(box), "_dw_eventbox", (gpointer)eventbox); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2103 g_object_set_data(G_OBJECT(box), "_dw_boxtype", GINT_TO_POINTER(type)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2104 g_object_set_data(G_OBJECT(box), "_dw_boxpad", GINT_TO_POINTER(pad)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2105 g_object_set_data(G_OBJECT(tmp), "_dw_boxhandle", (gpointer)box); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2106 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2107 gtk_container_add(GTK_CONTAINER(tmp), box); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2108 g_object_set_data(G_OBJECT(tmp), "_dw_user", box); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2109 gtk_widget_show(box); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2110 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2111 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2112 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2113 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2114 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2115 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2116 * Returns the position of the scrollbar in the scrollbox |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2117 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2118 * handle: Handle to the scrollbox to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2119 * orient: The vertical or horizontal scrollbar. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2120 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2121 int dw_scrollbox_get_pos(HWND handle, int orient) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2122 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2123 int val = -1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2124 GtkAdjustment *adjustment; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2125 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2126 if (!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2127 return -1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2128 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2129 if ( orient == DW_HORZ ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2130 adjustment = gtk_scrolled_window_get_hadjustment( GTK_SCROLLED_WINDOW(handle) ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2131 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2132 adjustment = gtk_scrolled_window_get_vadjustment( GTK_SCROLLED_WINDOW(handle) ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2133 if (adjustment) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2134 val = _round_value(gtk_adjustment_get_value(adjustment)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2135 return val; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2136 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2137 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2138 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2139 * Gets the range for the scrollbar in the scrollbox. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2140 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2141 * handle: Handle to the scrollbox to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2142 * orient: The vertical or horizontal scrollbar. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2143 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2144 int API dw_scrollbox_get_range(HWND handle, int orient) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2145 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2146 int range = -1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2147 GtkAdjustment *adjustment; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2148 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2149 if (!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2150 return -1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2151 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2152 if ( orient == DW_HORZ ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2153 adjustment = gtk_scrolled_window_get_hadjustment( GTK_SCROLLED_WINDOW(handle) ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2154 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2155 adjustment = gtk_scrolled_window_get_vadjustment( GTK_SCROLLED_WINDOW(handle) ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2156 if (adjustment) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2157 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2158 range = _round_value(gtk_adjustment_get_upper(adjustment)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2159 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2160 return range; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2161 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2162 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2163 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2164 * Create a new Group Box to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2165 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2166 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2167 * pad: Number of pixels to pad around the box. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2168 * title: Text to be displayined in the group outline. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2169 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2170 HWND dw_groupbox_new(int type, int pad, const char *title) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2171 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2172 GtkWidget *tmp, *frame; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2173 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2174 frame = gtk_frame_new(NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2175 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2176 gtk_frame_set_label(GTK_FRAME(frame), title && *title ? title : NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2177 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2178 tmp = gtk_grid_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2179 gtk_container_set_border_width(GTK_CONTAINER(tmp), pad); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2180 g_object_set_data(G_OBJECT(tmp), "_dw_boxtype", GINT_TO_POINTER(type)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2181 g_object_set_data(G_OBJECT(tmp), "_dw_boxpad", GINT_TO_POINTER(pad)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2182 g_object_set_data(G_OBJECT(frame), "_dw_boxhandle", (gpointer)tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2183 gtk_container_add(GTK_CONTAINER(frame), tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2184 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2185 gtk_widget_show(frame); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2186 if(_DWDefaultFont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2187 dw_window_set_font(frame, _DWDefaultFont); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2188 return frame; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2189 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2190 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2191 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2192 * Create a bitmap object to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2193 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2194 * id: An ID to be used with dw_window_from_id() or 0L. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2195 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2196 HWND dw_bitmap_new(unsigned long id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2197 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2198 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2199 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2200 tmp = gtk_image_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2201 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2202 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2203 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2204 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2205 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2206 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2207 * Create a notebook object to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2208 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2209 * id: An ID to be used for getting the resource from the |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2210 * resource file. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2211 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2212 HWND dw_notebook_new(unsigned long id, int top) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2213 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2214 GtkWidget *tmp, **pagearray = calloc(sizeof(GtkWidget *), 256); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2215 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2216 tmp = gtk_notebook_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2217 if(top) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2218 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(tmp), GTK_POS_TOP); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2219 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2220 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(tmp), GTK_POS_BOTTOM); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2221 gtk_notebook_set_scrollable(GTK_NOTEBOOK(tmp), TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2222 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2223 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2224 g_object_set_data(G_OBJECT(tmp), "_dw_pagearray", (gpointer)pagearray); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2225 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2226 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2227 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2228 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2229 * Create a menu object to be popped up. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2230 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2231 * id: An ID to be used for getting the resource from the |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2232 * resource file. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2233 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2234 HMENUI dw_menu_new(unsigned long id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2235 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2236 GtkAccelGroup *accel_group; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2237 HMENUI tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2238 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2239 tmp = gtk_menu_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2240 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2241 accel_group = gtk_accel_group_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2242 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2243 g_object_set_data(G_OBJECT(tmp), "_dw_accel", (gpointer)accel_group); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2244 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2245 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2246 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2247 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2248 * Create a menubar on a window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2249 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2250 * location: Handle of a window frame to be attached to. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2251 * If there is no box already packed into the "location", the menu will not appear |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2252 * so tell the user. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2253 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2254 HMENUI dw_menubar_new(HWND location) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2255 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2256 GtkAccelGroup *accel_group; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2257 GtkWidget *box; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2258 HMENUI tmp = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2259 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2260 if(GTK_IS_WINDOW(location) && |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2261 (box = (GtkWidget *)g_object_get_data(G_OBJECT(location), "_dw_grid"))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2262 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2263 /* If there is an existing menu bar, remove it */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2264 GtkWidget *oldmenu = (GtkWidget *)g_object_get_data(G_OBJECT(location), "_dw_menubar"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2265 if(oldmenu) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2266 gtk_widget_destroy(oldmenu); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2267 /* Create a new menu bar */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2268 tmp = gtk_menu_bar_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2269 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2270 accel_group = gtk_accel_group_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2271 g_object_set_data(G_OBJECT(tmp), "_dw_accel", (gpointer)accel_group); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2272 /* Save pointers to each other */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2273 g_object_set_data(G_OBJECT(location), "_dw_menubar", (gpointer)tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2274 g_object_set_data(G_OBJECT(tmp), "_dw_window", (gpointer)location); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2275 gtk_grid_attach(GTK_GRID(box), tmp, 0, 0, 1, 1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2276 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2277 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2278 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2279 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2280 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2281 * Destroys a menu created with dw_menubar_new or dw_menu_new. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2282 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2283 * menu: Handle of a menu. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2284 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2285 void dw_menu_destroy(HMENUI *menu) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2286 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2287 if(menu && *menu) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2288 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2289 GtkWidget *window; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2290 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2291 /* If it is a menu bar, try to delete the reference to it */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2292 if(GTK_IS_MENU_BAR(*menu) && |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2293 (window = (GtkWidget *)g_object_get_data(G_OBJECT(*menu), "_dw_window"))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2294 g_object_set_data(G_OBJECT(window), "_dw_menubar", NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2295 /* Actually destroy the menu */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2296 gtk_widget_destroy(*menu); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2297 *menu = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2298 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2299 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2300 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2301 char _removetilde(char *dest, const char *src) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2302 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2303 int z, cur=0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2304 char accel = '\0'; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2305 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2306 for(z=0;z<strlen(src);z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2307 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2308 if(src[z] != '~') |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2309 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2310 dest[cur] = src[z]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2311 cur++; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2312 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2313 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2314 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2315 dest[cur] = '_'; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2316 accel = src[z+1]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2317 cur++; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2318 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2319 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2320 dest[cur] = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2321 return accel; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2322 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2323 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2324 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2325 * Adds a menuitem or submenu to an existing menu. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2326 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2327 * menu: The handle to the existing menu. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2328 * title: The title text on the menu item to be added. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2329 * id: An ID to be used for message passing. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2330 * flags: Extended attributes to set on the menu. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2331 * end: If TRUE memu is positioned at the end of the menu. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2332 * check: If TRUE menu is "check"able. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2333 * submenu: Handle to an existing menu to be a submenu or NULL. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2334 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2335 HWND dw_menu_append_item(HMENUI menu, const char *title, unsigned long id, unsigned long flags, int end, int check, HMENUI submenu) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2336 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2337 GtkWidget *tmphandle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2338 char accel, *tempbuf = malloc(strlen(title)+1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2339 int submenucount; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2340 GtkAccelGroup *accel_group; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2341 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2342 if (!menu) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2343 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2344 free(tempbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2345 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2346 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2347 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2348 accel = _removetilde(tempbuf, title); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2349 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2350 accel_group = (GtkAccelGroup *)g_object_get_data(G_OBJECT(menu), "_dw_accel"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2351 submenucount = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(menu), "_dw_submenucount")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2352 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2353 if (strlen(tempbuf) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2354 tmphandle=gtk_menu_item_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2355 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2356 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2357 char numbuf[25] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2358 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2359 if (check) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2360 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2361 tmphandle = gtk_check_menu_item_new_with_label(tempbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2362 if (accel && accel_group) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2363 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2364 gtk_label_set_use_underline(GTK_LABEL(gtk_bin_get_child(GTK_BIN(tmphandle))), TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2365 #if 0 /* TODO: This isn't working right */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2366 gtk_widget_add_accelerator(tmphandle, "activate", accel_group, tmp_key, GDK_MOD1_MASK, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2367 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2368 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2369 snprintf(numbuf, 24, "%lu", id); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2370 g_object_set_data(G_OBJECT(menu), numbuf, (gpointer)tmphandle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2371 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2372 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2373 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2374 tmphandle=gtk_menu_item_new_with_label(tempbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2375 if (accel && accel_group) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2376 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2377 gtk_label_set_use_underline(GTK_LABEL(gtk_bin_get_child(GTK_BIN(tmphandle))), TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2378 #if 0 /* TODO: This isn't working right */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2379 gtk_widget_add_accelerator(tmphandle, "activate", accel_group, tmp_key, GDK_MOD1_MASK, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2380 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2381 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2382 snprintf(numbuf, 24, "%lu", id); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2383 g_object_set_data(G_OBJECT(menu), numbuf, (gpointer)tmphandle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2384 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2385 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2386 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2387 gtk_widget_show(tmphandle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2388 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2389 if (submenu) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2390 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2391 char tempbuf[101] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2392 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2393 snprintf(tempbuf, 100, "_dw_submenu%d", submenucount); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2394 submenucount++; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2395 gtk_menu_item_set_submenu(GTK_MENU_ITEM(tmphandle), submenu); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2396 g_object_set_data(G_OBJECT(menu), tempbuf, (gpointer)submenu); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2397 g_object_set_data(G_OBJECT(menu), "_dw_submenucount", GINT_TO_POINTER(submenucount)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2398 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2399 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2400 if (GTK_IS_MENU_BAR(menu)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2401 gtk_menu_shell_append(GTK_MENU_SHELL(menu), tmphandle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2402 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2403 gtk_menu_shell_append(GTK_MENU_SHELL(menu), tmphandle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2404 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2405 g_object_set_data(G_OBJECT(tmphandle), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2406 free(tempbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2407 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2408 * Set flags |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2409 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2410 if ( check && (flags & DW_MIS_CHECKED) ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2411 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2412 _dw_ignore_click = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2413 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(tmphandle), 1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2414 _dw_ignore_click = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2415 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2416 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2417 if ( flags & DW_MIS_DISABLED ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2418 gtk_widget_set_sensitive( tmphandle, FALSE ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2419 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2420 return tmphandle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2421 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2422 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2423 GtkWidget *_find_submenu_id(GtkWidget *start, const char *name) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2424 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2425 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2426 int z, submenucount = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(start), "_dw_submenucount")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2427 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2428 if((tmp = g_object_get_data(G_OBJECT(start), name))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2429 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2430 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2431 for(z=0;z<submenucount;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2432 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2433 char tempbuf[101] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2434 GtkWidget *submenu, *menuitem; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2435 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2436 snprintf(tempbuf, 100, "_dw_submenu%d", z); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2437 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2438 if((submenu = g_object_get_data(G_OBJECT(start), tempbuf))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2439 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2440 if((menuitem = _find_submenu_id(submenu, name))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2441 return menuitem; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2442 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2443 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2444 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2445 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2446 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2447 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2448 * Sets the state of a menu item check. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2449 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2450 * menu: The handle the the existing menu. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2451 * id: Menuitem id. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2452 * check: TRUE for checked FALSE for not checked. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2453 * deprecated: use dw_menu_item_set_state() |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2454 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2455 void dw_menu_item_set_check(HMENUI menu, unsigned long id, int check) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2456 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2457 char numbuf[25] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2458 GtkWidget *tmphandle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2459 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2460 if(!menu) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2461 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2462 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2463 snprintf(numbuf, 24, "%lu", id); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2464 tmphandle = _find_submenu_id(menu, numbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2465 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2466 if(tmphandle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2467 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2468 _dw_ignore_click = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2469 if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(tmphandle)) != check) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2470 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(tmphandle), check); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2471 _dw_ignore_click = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2472 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2473 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2474 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2475 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2476 * Sets the state of a menu item. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2477 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2478 * menu: The handle the the existing menu. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2479 * id: Menuitem id. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2480 * state: TRUE for checked FALSE for not checked. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2481 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2482 void dw_menu_item_set_state(HMENUI menu, unsigned long id, unsigned long state) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2483 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2484 char numbuf[25] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2485 GtkWidget *tmphandle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2486 int check; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2487 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2488 if(!menu) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2489 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2490 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2491 snprintf(numbuf, 24, "%lu", id); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2492 tmphandle = _find_submenu_id(menu, numbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2493 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2494 if ( (state & DW_MIS_CHECKED) || (state & DW_MIS_UNCHECKED) ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2495 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2496 if ( state & DW_MIS_CHECKED ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2497 check = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2498 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2499 check = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2500 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2501 if (tmphandle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2502 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2503 _dw_ignore_click = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2504 if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(tmphandle)) != check) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2505 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(tmphandle), check); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2506 _dw_ignore_click = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2507 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2508 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2509 if ( (state & DW_MIS_ENABLED) || (state & DW_MIS_DISABLED) ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2510 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2511 if (tmphandle ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2512 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2513 _dw_ignore_click = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2514 if ( state & DW_MIS_ENABLED ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2515 gtk_widget_set_sensitive( tmphandle, TRUE ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2516 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2517 gtk_widget_set_sensitive( tmphandle, FALSE ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2518 _dw_ignore_click = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2519 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2520 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2521 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2522 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2523 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2524 * Deletes the menu item specified. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2525 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2526 * menu: The handle to the menu in which the item was appended. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2527 * id: Menuitem id. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2528 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2529 * DW_ERROR_NONE (0) on success or DW_ERROR_UNKNOWN on failure. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2530 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2531 int API dw_menu_delete_item(HMENUI menu, unsigned long id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2532 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2533 char numbuf[25] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2534 GtkWidget *tmphandle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2535 int ret = DW_ERROR_UNKNOWN; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2536 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2537 if(!menu) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2538 return ret; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2539 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2540 snprintf(numbuf, 24, "%lu", id); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2541 tmphandle = _find_submenu_id(menu, numbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2542 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2543 if(tmphandle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2544 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2545 gtk_widget_destroy(tmphandle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2546 g_object_set_data(G_OBJECT(menu), numbuf, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2547 ret = DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2548 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2549 return ret; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2550 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2551 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2552 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2553 * Pops up a context menu at given x and y coordinates. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2554 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2555 * menu: The handle the the existing menu. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2556 * parent: Handle to the window initiating the popup. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2557 * x: X coordinate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2558 * y: Y coordinate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2559 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2560 void dw_menu_popup(HMENUI *menu, HWND parent, int x, int y) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2561 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2562 if(!menu || !*menu) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2563 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2564 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2565 popup = parent; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2566 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2567 gtk_menu_popup_at_pointer(GTK_MENU(*menu), NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2568 *menu = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2569 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2570 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2571 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2572 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2573 * Returns the current X and Y coordinates of the mouse pointer. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2574 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2575 * x: Pointer to variable to store X coordinate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2576 * y: Pointer to variable to store Y coordinate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2577 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2578 void dw_pointer_query_pos(long *x, long *y) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2579 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2580 GdkModifierType state = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2581 int gx, gy; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2582 GdkDisplay *display; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2583 GdkDevice *device; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2584 GdkSeat *seat; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2585 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2586 #ifdef GDK_WINDOWING_X11 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2587 display = gdk_display_get_default(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2588 seat = gdk_display_get_default_seat(display); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2589 device = gdk_seat_get_pointer(seat); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2590 gdk_window_get_device_position(gdk_x11_window_lookup_for_display(display, GDK_ROOT_WINDOW()), |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2591 device, &gx, &gy, &state); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2592 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2593 if(x) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2594 *x = gx; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2595 if(y) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2596 *y = gy; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2597 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2598 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2599 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2600 * Sets the X and Y coordinates of the mouse pointer. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2601 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2602 * x: X coordinate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2603 * y: Y coordinate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2604 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2605 void dw_pointer_set_pos(long x, long y) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2606 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2607 GdkDisplay *display; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2608 GdkDevice *device; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2609 GdkSeat *seat; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2610 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2611 #ifdef GDK_WINDOWING_X11 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2612 display = gdk_display_get_default(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2613 seat = gdk_display_get_default_seat(display); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2614 device = gdk_seat_get_pointer(seat); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2615 gdk_device_warp(device, gdk_screen_get_default(), x, y); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2616 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2617 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2618 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2619 #define _DW_TREE_CONTAINER 1 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2620 #define _DW_TREE_TREE 2 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2621 #define _DW_TREE_LISTBOX 3 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2622 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2623 GtkWidget *_tree_create(unsigned long id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2624 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2625 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2626 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2627 tmp = gtk_scrolled_window_new(NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2628 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (tmp), |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2629 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2630 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2631 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2632 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2633 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2634 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2635 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2636 GtkWidget *_tree_setup(GtkWidget *tmp, GtkTreeModel *store) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2637 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2638 GtkWidget *tree = gtk_tree_view_new_with_model(store); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2639 gtk_tree_view_set_enable_search(GTK_TREE_VIEW(tree), FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2640 #if GTK_CHECK_VERSION(3,8,0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2641 gtk_container_add(GTK_CONTAINER(tmp), tree); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2642 #else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2643 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(tmp), tree); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2644 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2645 g_object_set_data(G_OBJECT(tmp), "_dw_user", (gpointer)tree); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2646 return tree; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2647 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2648 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2649 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2650 * Create a container object to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2651 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2652 * id: An ID to be used for getting the resource from the |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2653 * resource file. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2654 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2655 HWND dw_container_new(unsigned long id, int multi) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2656 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2657 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2658 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2659 if(!(tmp = _tree_create(id))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2660 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2661 g_object_set_data(G_OBJECT(tmp), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2662 g_object_set_data(G_OBJECT(tmp), "_dw_multi_sel", GINT_TO_POINTER(multi)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2663 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2664 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2665 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2666 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2667 * Create a tree object to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2668 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2669 * id: An ID to be used for getting the resource from the |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2670 * resource file. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2671 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2672 HWND dw_tree_new(ULONG id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2673 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2674 GtkWidget *tmp, *tree; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2675 GtkTreeStore *store; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2676 GtkTreeViewColumn *col; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2677 GtkCellRenderer *rend; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2678 GtkTreeSelection *sel; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2679 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2680 if(!(tmp = _tree_create(id))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2681 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2682 store = gtk_tree_store_new(4, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_POINTER, G_TYPE_POINTER); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2683 tree = _tree_setup(tmp, GTK_TREE_MODEL(store)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2684 g_object_set_data(G_OBJECT(tmp), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_TREE)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2685 g_object_set_data(G_OBJECT(tree), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_TREE)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2686 col = gtk_tree_view_column_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2687 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2688 rend = gtk_cell_renderer_pixbuf_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2689 gtk_tree_view_column_pack_start(col, rend, FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2690 gtk_tree_view_column_add_attribute(col, rend, "pixbuf", 1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2691 rend = gtk_cell_renderer_text_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2692 gtk_tree_view_column_pack_start(col, rend, TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2693 gtk_tree_view_column_add_attribute(col, rend, "text", 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2694 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2695 gtk_tree_view_append_column(GTK_TREE_VIEW (tree), col); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2696 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(tree), col); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2697 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2698 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2699 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2700 gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2701 gtk_widget_show(tree); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2702 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2703 if(_DWDefaultFont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2704 dw_window_set_font(tmp, _DWDefaultFont); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2705 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2706 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2707 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2708 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2709 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2710 * Create a new static text window (widget) to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2711 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2712 * text: The text to be display by the static text widget. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2713 * id: An ID to be used with dw_window_from_id() or 0L. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2714 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2715 HWND dw_text_new(const char *text, unsigned long id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2716 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2717 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2718 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2719 tmp = gtk_label_new(text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2720 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2721 /* Left and centered */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2722 gtk_label_set_xalign(GTK_LABEL(tmp), 0.0f); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2723 gtk_label_set_yalign(GTK_LABEL(tmp), 0.5f); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2724 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2725 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2726 if(_DWDefaultFont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2727 dw_window_set_font(tmp, _DWDefaultFont); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2728 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2729 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2730 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2731 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2732 * Create a new status text window (widget) to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2733 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2734 * text: The text to be display by the static text widget. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2735 * id: An ID to be used with dw_window_from_id() or 0L. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2736 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2737 HWND dw_status_text_new(const char *text, ULONG id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2738 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2739 GtkWidget *tmp, *frame; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2740 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2741 frame = gtk_frame_new(NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2742 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2743 tmp = gtk_label_new(text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2744 gtk_container_add(GTK_CONTAINER(frame), tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2745 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2746 gtk_widget_show(frame); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2747 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2748 /* Left and centered */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2749 gtk_label_set_xalign(GTK_LABEL(tmp), 0.0f); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2750 gtk_label_set_yalign(GTK_LABEL(tmp), 0.5f); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2751 g_object_set_data(G_OBJECT(frame), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2752 g_object_set_data(G_OBJECT(frame), "_dw_label", (gpointer)tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2753 if(_DWDefaultFont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2754 dw_window_set_font(tmp, _DWDefaultFont); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2755 return frame; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2756 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2757 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2758 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2759 * Create a new Multiline Editbox window (widget) to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2760 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2761 * id: An ID to be used with dw_window_from_id() or 0L. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2762 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2763 HWND dw_mle_new(unsigned long id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2764 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2765 GtkWidget *tmp, *tmpbox; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2766 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2767 tmpbox = gtk_scrolled_window_new (NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2768 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(tmpbox), |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2769 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2770 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(tmpbox), GTK_SHADOW_ETCHED_IN); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2771 tmp = gtk_text_view_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2772 gtk_container_add (GTK_CONTAINER(tmpbox), tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2773 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(tmp), GTK_WRAP_WORD); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2774 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2775 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2776 g_object_set_data(G_OBJECT(tmpbox), "_dw_user", (gpointer)tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2777 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2778 gtk_widget_show(tmpbox); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2779 if(_DWDefaultFont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2780 dw_window_set_font(tmpbox, _DWDefaultFont); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2781 return tmpbox; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2782 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2783 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2784 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2785 * Create a new Entryfield window (widget) to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2786 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2787 * text: The default text to be in the entryfield widget. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2788 * id: An ID to be used with dw_window_from_id() or 0L. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2789 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2790 HWND dw_entryfield_new(const char *text, unsigned long id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2791 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2792 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2793 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2794 tmp = gtk_entry_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2795 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2796 gtk_entry_set_text(GTK_ENTRY(tmp), text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2797 gtk_entry_set_width_chars(GTK_ENTRY(tmp), 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2798 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2799 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2800 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2801 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2802 if(_DWDefaultFont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2803 dw_window_set_font(tmp, _DWDefaultFont); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2804 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2805 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2806 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2807 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2808 * Create a new Entryfield (password) window (widget) to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2809 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2810 * text: The default text to be in the entryfield widget. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2811 * id: An ID to be used with dw_window_from_id() or 0L. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2812 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2813 HWND dw_entryfield_password_new(const char *text, ULONG id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2814 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2815 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2816 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2817 tmp = gtk_entry_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2818 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2819 gtk_entry_set_visibility(GTK_ENTRY(tmp), FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2820 gtk_entry_set_text(GTK_ENTRY(tmp), text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2821 gtk_entry_set_width_chars(GTK_ENTRY(tmp), 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2822 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2823 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2824 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2825 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2826 if(_DWDefaultFont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2827 dw_window_set_font(tmp, _DWDefaultFont); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2828 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2829 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2830 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2831 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2832 * Create a new Combobox window (widget) to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2833 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2834 * text: The default text to be in the combpbox widget. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2835 * id: An ID to be used with dw_window_from_id() or 0L. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2836 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2837 HWND dw_combobox_new(const char *text, unsigned long id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2838 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2839 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2840 GtkListStore *store; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2841 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2842 store = gtk_list_store_new(1, G_TYPE_STRING); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2843 tmp = gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(store)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2844 gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(tmp), 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2845 gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(tmp))), text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2846 gtk_entry_set_width_chars(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(tmp))), 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2847 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2848 g_object_set_data(G_OBJECT(tmp), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_COMBOBOX)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2849 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2850 if(_DWDefaultFont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2851 dw_window_set_font(tmp, _DWDefaultFont); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2852 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2853 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2854 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2855 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2856 * Create a new button window (widget) to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2857 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2858 * text: The text to be display by the static text widget. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2859 * id: An ID to be used with dw_window_from_id() or 0L. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2860 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2861 HWND dw_button_new(const char *text, unsigned long id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2862 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2863 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2864 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2865 tmp = gtk_button_new_with_label(text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2866 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2867 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2868 if(_DWDefaultFont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2869 dw_window_set_font(tmp, _DWDefaultFont); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2870 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2871 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2872 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2873 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2874 * Create a new bitmap button window (widget) to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2875 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2876 * text: Bubble help text to be displayed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2877 * id: An ID of a bitmap in the resource file. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2878 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2879 HWND dw_bitmapbutton_new(const char *text, unsigned long id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2880 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2881 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2882 GtkWidget *bitmap; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2883 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2884 tmp = gtk_button_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2885 bitmap = dw_bitmap_new(id); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2886 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2887 if(bitmap) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2888 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2889 dw_window_set_bitmap(bitmap, id, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2890 gtk_container_add (GTK_CONTAINER(tmp), bitmap); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2891 g_object_set_data(G_OBJECT(tmp), "_dw_bitmap", bitmap); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2892 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2893 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2894 if(text) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2895 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2896 gtk_widget_set_tooltip_text(tmp, text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2897 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2898 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2899 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2900 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2901 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2902 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2903 * Create a new bitmap button window (widget) to be packed from a file. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2904 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2905 * label_text: Text to display on button. TBD when Windows works |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2906 * text: Bubble help text to be displayed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2907 * id: An ID to be used with dw_window_from_id() or 0L. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2908 * filename: Name of the file, omit extention to have |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2909 * DW pick the appropriate file extension. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2910 * (BMP on OS/2 or Windows, XPM on Unix) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2911 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2912 HWND dw_bitmapbutton_new_from_file(const char *text, unsigned long id, const char *filename) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2913 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2914 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2915 GtkWidget *bitmap; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2916 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2917 /* Create a new button */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2918 tmp = gtk_button_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2919 /* Now on to the image stuff */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2920 bitmap = dw_bitmap_new(id); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2921 if(bitmap) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2922 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2923 dw_window_set_bitmap( bitmap, 0, filename ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2924 gtk_container_add (GTK_CONTAINER(tmp), bitmap); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2925 g_object_set_data(G_OBJECT(tmp), "_dw_bitmap", bitmap); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2926 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2927 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2928 if(text) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2929 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2930 gtk_widget_set_tooltip_text(tmp, text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2931 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2932 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2933 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2934 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2935 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2936 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2937 * Create a new bitmap button window (widget) to be packed from data. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2938 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2939 * text: Bubble help text to be displayed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2940 * id: An ID to be used with dw_window_from_id() or 0L. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2941 * data: Raw data of image. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2942 * (BMP on OS/2 or Windows, XPM on Unix) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2943 * len: Length of raw data |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2944 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2945 HWND dw_bitmapbutton_new_from_data(const char *text, unsigned long id, const char *data, int len) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2946 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2947 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2948 GtkWidget *bitmap; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2949 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2950 tmp = gtk_button_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2951 bitmap = dw_bitmap_new(id); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2952 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2953 if(bitmap) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2954 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2955 dw_window_set_bitmap_from_data(bitmap, 0, data, len); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2956 gtk_container_add (GTK_CONTAINER(tmp), bitmap); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2957 g_object_set_data(G_OBJECT(tmp), "_dw_bitmap", bitmap); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2958 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2959 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2960 if(text) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2961 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2962 gtk_widget_set_tooltip_text(tmp, text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2963 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2964 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2965 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2966 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2967 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2968 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2969 * Create a new spinbutton window (widget) to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2970 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2971 * text: The text to be display by the static text widget. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2972 * id: An ID to be used with dw_window_from_id() or 0L. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2973 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2974 HWND dw_spinbutton_new(const char *text, unsigned long id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2975 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2976 GtkAdjustment *adj; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2977 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2978 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2979 adj = (GtkAdjustment *)gtk_adjustment_new ((float)atoi(text), -65536.0, 65536.0, 1.0, 5.0, 0.0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2980 tmp = gtk_spin_button_new (adj, 0, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2981 gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(tmp), TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2982 gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(tmp), TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2983 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2984 g_object_set_data(G_OBJECT(tmp), "_dw_adjustment", (gpointer)adj); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2985 g_object_set_data(G_OBJECT(adj), "_dw_spinbutton", (gpointer)tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2986 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2987 if(_DWDefaultFont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2988 dw_window_set_font(tmp, _DWDefaultFont); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2989 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2990 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2991 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2992 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2993 * Create a new radiobutton window (widget) to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2994 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2995 * text: The text to be display by the static text widget. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2996 * id: An ID to be used with dw_window_from_id() or 0L. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2997 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2998 HWND dw_radiobutton_new(const char *text, ULONG id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2999 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3000 /* This will have to be fixed in the future. */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3001 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3002 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3003 tmp = gtk_radio_button_new_with_label(NULL, text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3004 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3005 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3006 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3007 if(_DWDefaultFont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3008 dw_window_set_font(tmp, _DWDefaultFont); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3009 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3010 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3011 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3012 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3013 * Create a new slider window (widget) to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3014 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3015 * vertical: TRUE or FALSE if slider is vertical. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3016 * increments: Number of increments available. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3017 * id: An ID to be used with dw_window_from_id() or 0L. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3018 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3019 HWND dw_slider_new(int vertical, int increments, ULONG id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3020 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3021 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3022 GtkAdjustment *adjustment; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3023 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3024 adjustment = (GtkAdjustment *)gtk_adjustment_new(0, 0, (gfloat)increments, 1, 1, 1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3025 tmp = gtk_scale_new(vertical ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL, adjustment); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3026 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3027 gtk_scale_set_draw_value(GTK_SCALE(tmp), 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3028 gtk_scale_set_digits(GTK_SCALE(tmp), 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3029 g_object_set_data(G_OBJECT(tmp), "_dw_adjustment", (gpointer)adjustment); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3030 g_object_set_data(G_OBJECT(adjustment), "_dw_slider", (gpointer)tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3031 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3032 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3033 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3034 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3035 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3036 * Create a new scrollbar window (widget) to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3037 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3038 * vertical: TRUE or FALSE if scrollbar is vertical. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3039 * increments: Number of increments available. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3040 * id: An ID to be used with dw_window_from_id() or 0L. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3041 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3042 HWND dw_scrollbar_new(int vertical, ULONG id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3043 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3044 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3045 GtkAdjustment *adjustment; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3046 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3047 adjustment = (GtkAdjustment *)gtk_adjustment_new(0, 0, 0, 1, 1, 1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3048 tmp = gtk_scrollbar_new(vertical ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL, adjustment); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3049 gtk_widget_set_can_focus(tmp, FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3050 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3051 g_object_set_data(G_OBJECT(tmp), "_dw_adjustment", (gpointer)adjustment); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3052 g_object_set_data(G_OBJECT(adjustment), "_dw_scrollbar", (gpointer)tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3053 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3054 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3055 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3056 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3057 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3058 * Create a new percent bar window (widget) to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3059 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3060 * id: An ID to be used with dw_window_from_id() or 0L. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3061 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3062 HWND dw_percent_new(unsigned long id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3063 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3064 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3065 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3066 tmp = gtk_progress_bar_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3067 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3068 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3069 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3070 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3071 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3072 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3073 * Create a new checkbox window (widget) to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3074 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3075 * text: The text to be display by the static text widget. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3076 * id: An ID to be used with dw_window_from_id() or 0L. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3077 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3078 HWND dw_checkbox_new(const char *text, unsigned long id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3079 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3080 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3081 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3082 tmp = gtk_check_button_new_with_label(text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3083 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3084 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3085 if(_DWDefaultFont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3086 dw_window_set_font(tmp, _DWDefaultFont); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3087 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3088 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3089 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3090 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3091 * Create a new listbox window (widget) to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3092 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3093 * id: An ID to be used with dw_window_from_id() or 0L. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3094 * multi: Multiple select TRUE or FALSE. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3095 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3096 HWND dw_listbox_new(unsigned long id, int multi) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3097 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3098 GtkWidget *tmp, *tree; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3099 GtkListStore *store; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3100 GtkTreeViewColumn *col; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3101 GtkCellRenderer *rend; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3102 GtkTreeSelection *sel; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3103 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3104 if(!(tmp = _tree_create(id))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3105 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3106 store = gtk_list_store_new(1, G_TYPE_STRING); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3107 tree = _tree_setup(tmp, GTK_TREE_MODEL(store)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3108 g_object_set_data(G_OBJECT(tmp), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3109 g_object_set_data(G_OBJECT(tree), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3110 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3111 col = gtk_tree_view_column_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3112 rend = gtk_cell_renderer_text_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3113 gtk_tree_view_column_pack_start(col, rend, TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3114 gtk_tree_view_column_add_attribute(col, rend, "text", 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3115 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3116 gtk_tree_view_append_column(GTK_TREE_VIEW (tree), col); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3117 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(tree), col); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3118 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3119 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3120 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3121 if(multi) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3122 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3123 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3124 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3125 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3126 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3127 gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3128 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3129 gtk_widget_show(tree); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3130 if(_DWDefaultFont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3131 dw_window_set_font(tmp, _DWDefaultFont); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3132 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3133 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3134 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3135 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3136 * Sets the icon used for a given window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3137 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3138 * handle: Handle to the window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3139 * id: An ID to be used to specify the icon. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3140 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3141 void dw_window_set_icon(HWND handle, HICN icon) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3142 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3143 GdkPixbuf *icon_pixbuf; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3144 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3145 icon_pixbuf = _find_pixbuf(icon, NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3146 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3147 if(gtk_widget_get_window(handle) && icon_pixbuf) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3148 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3149 GList *list = g_list_append(NULL, icon_pixbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3150 gdk_window_set_icon_list(gtk_widget_get_window(handle), list); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3151 g_list_free(list); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3152 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3153 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3154 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3155 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3156 * Sets the bitmap used for a given static window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3157 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3158 * handle: Handle to the window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3159 * id: An ID to be used to specify the icon, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3160 * (pass 0 if you use the filename param) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3161 * filename: a path to a file (Bitmap on OS/2 or |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3162 * Windows and a pixmap on Unix, pass |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3163 * NULL if you use the id param) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3164 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3165 void dw_window_set_bitmap(HWND handle, unsigned long id, const char *filename) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3166 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3167 GdkPixbuf *tmp = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3168 int found_ext = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3169 int i; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3170 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3171 if(!id && !filename) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3172 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3173 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3174 if(id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3175 tmp = _find_pixbuf((HICN)id, NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3176 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3177 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3178 char *file = alloca(strlen(filename) + 6); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3179 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3180 if (!file) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3181 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3182 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3183 strcpy(file, filename); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3184 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3185 /* check if we can read from this file (it exists and read permission) */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3186 if ( access(file, 04 ) != 0 ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3187 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3188 /* Try with various extentions */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3189 for ( i = 0; i < NUM_EXTS; i++ ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3190 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3191 strcpy( file, filename ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3192 strcat( file, image_exts[i] ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3193 if ( access( file, 04 ) == 0 ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3194 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3195 found_ext = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3196 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3197 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3198 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3199 if ( found_ext == 0 ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3200 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3201 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3202 tmp = gdk_pixbuf_new_from_file(file, NULL ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3203 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3204 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3205 if (tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3206 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3207 if ( GTK_IS_BUTTON(handle) ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3208 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3209 GtkWidget *pixmap = (GtkWidget *)g_object_get_data( G_OBJECT(handle), "_dw_bitmap" ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3210 if(pixmap) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3211 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3212 gtk_image_set_from_pixbuf(GTK_IMAGE(pixmap), tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3213 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3214 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3215 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3216 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3217 gtk_image_set_from_pixbuf(GTK_IMAGE(handle), tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3218 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3219 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3220 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3221 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3222 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3223 * Sets the bitmap used for a given static window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3224 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3225 * handle: Handle to the window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3226 * id: An ID to be used to specify the icon, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3227 * (pass 0 if you use the filename param) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3228 * data: the image data |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3229 * Bitmap on Windows and a pixmap on Unix, pass |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3230 * NULL if you use the id param) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3231 * len: length of data |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3232 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3233 void dw_window_set_bitmap_from_data(HWND handle, unsigned long id, const char *data, int len) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3234 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3235 GdkPixbuf *tmp = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3236 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3237 if(!id && !data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3238 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3239 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3240 if(data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3241 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3242 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3243 * A real hack; create a temporary file and write the contents |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3244 * of the data to the file |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3245 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3246 char template[] = "/tmp/dwpixmapXXXXXX"; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3247 int written = -1, fd = mkstemp(template); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3248 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3249 if(fd != -1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3250 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3251 written = write(fd, data, len); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3252 close(fd); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3253 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3254 /* Bail if we couldn't write full file */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3255 if(fd == -1 || written != len) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3256 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3257 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3258 tmp = gdk_pixbuf_new_from_file(template, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3259 /* remove our temporary file */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3260 unlink(template); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3261 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3262 else if (id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3263 tmp = _find_pixbuf((HICN)id, NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3264 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3265 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3266 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3267 if(GTK_IS_BUTTON(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3268 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3269 GtkWidget *pixmap = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_bitmap"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3270 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3271 if(pixmap) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3272 gtk_image_set_from_pixbuf(GTK_IMAGE(pixmap), tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3273 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3274 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3275 gtk_image_set_from_pixbuf(GTK_IMAGE(handle), tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3276 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3277 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3278 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3279 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3280 * Sets the text used for a given window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3281 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3282 * handle: Handle to the window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3283 * text: The text associated with a given window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3284 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3285 void dw_window_set_text(HWND handle, const char *text) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3286 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3287 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3288 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3289 if((tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_mdi_title"))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3290 handle = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3291 if(GTK_IS_ENTRY(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3292 gtk_entry_set_text(GTK_ENTRY(handle), text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3293 else if(GTK_IS_COMBO_BOX(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3294 gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(handle))), text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3295 else if(GTK_IS_LABEL(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3296 gtk_label_set_text(GTK_LABEL(handle), text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3297 else if(GTK_IS_BUTTON(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3298 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3299 gtk_button_set_label(GTK_BUTTON(handle), text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3300 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3301 else if(gtk_widget_is_toplevel(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3302 gtk_window_set_title(GTK_WINDOW(handle), text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3303 else if (GTK_IS_FRAME(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3304 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3305 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3306 * This is a groupbox or status_text |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3307 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3308 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_label"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3309 if ( tmp && GTK_IS_LABEL(tmp) ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3310 gtk_label_set_text(GTK_LABEL(tmp), text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3311 else /* assume groupbox */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3312 gtk_frame_set_label(GTK_FRAME(handle), text && *text ? text : NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3313 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3314 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3315 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3316 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3317 * Sets the text used for a given window's floating bubble help. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3318 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3319 * handle: Handle to the window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3320 * bubbletext: The text in the floating bubble tooltip. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3321 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3322 void API dw_window_set_tooltip(HWND handle, const char *bubbletext) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3323 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3324 if(bubbletext && *bubbletext) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3325 gtk_widget_set_tooltip_text(handle, bubbletext); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3326 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3327 gtk_widget_set_has_tooltip(handle, FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3328 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3329 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3330 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3331 * Gets the text used for a given window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3332 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3333 * handle: Handle to the window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3334 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3335 * text: The text associsated with a given window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3336 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3337 char *dw_window_get_text(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3338 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3339 const char *possible = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3340 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3341 if(GTK_IS_ENTRY(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3342 possible = gtk_entry_get_text(GTK_ENTRY(handle)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3343 else if(GTK_IS_COMBO_BOX(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3344 possible = gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(handle)))); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3345 else if(GTK_IS_LABEL(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3346 possible = gtk_label_get_text(GTK_LABEL(handle)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3347 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3348 return strdup(possible ? possible : ""); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3349 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3350 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3351 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3352 * Disables given window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3353 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3354 * handle: Handle to the window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3355 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3356 void dw_window_disable(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3357 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3358 gtk_widget_set_sensitive(handle, FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3359 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3360 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3361 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3362 * Enables given window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3363 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3364 * handle: Handle to the window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3365 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3366 void dw_window_enable(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3367 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3368 gtk_widget_set_sensitive(handle, TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3369 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3370 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3371 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3372 * Gets the child window handle with specified ID. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3373 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3374 * handle: Handle to the parent window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3375 * id: Integer ID of the child. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3376 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3377 HWND API dw_window_from_id(HWND handle, int id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3378 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3379 GList *orig = NULL, *list = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3380 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3381 if(handle && GTK_IS_CONTAINER(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3382 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3383 orig = list = gtk_container_get_children(GTK_CONTAINER(handle)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3384 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3385 while(list) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3386 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3387 if(GTK_IS_WIDGET(list->data)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3388 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3389 if(id == GPOINTER_TO_INT(g_object_get_data(G_OBJECT(list->data), "_dw_id"))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3390 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3391 HWND ret = (HWND)list->data; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3392 g_list_free(orig); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3393 return ret; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3394 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3395 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3396 list = list->next; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3397 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3398 if(orig) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3399 g_list_free(orig); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3400 return 0L; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3401 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3402 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3403 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3404 * Adds text to an MLE box and returns the current point. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3405 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3406 * handle: Handle to the MLE to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3407 * buffer: Text buffer to be imported. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3408 * startpoint: Point to start entering text. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3409 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3410 unsigned int dw_mle_import(HWND handle, const char *buffer, int startpoint) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3411 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3412 unsigned int tmppoint = startpoint; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3413 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3414 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3415 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3416 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3417 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3418 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3419 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3420 GtkTextBuffer *tbuffer; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3421 GtkTextIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3422 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3423 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3424 gtk_text_buffer_get_iter_at_offset(tbuffer, &iter, startpoint); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3425 gtk_text_buffer_place_cursor(tbuffer, &iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3426 gtk_text_buffer_insert_at_cursor(tbuffer, buffer, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3427 tmppoint = (startpoint > -1 ? startpoint : 0) + strlen(buffer); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3428 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3429 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3430 return tmppoint; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3431 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3432 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3433 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3434 * Grabs text from an MLE box. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3435 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3436 * handle: Handle to the MLE to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3437 * buffer: Text buffer to be exported. MUST allow for trailing nul character. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3438 * startpoint: Point to start grabbing text. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3439 * length: Amount of text to be grabbed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3440 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3441 void dw_mle_export(HWND handle, char *buffer, int startpoint, int length) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3442 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3443 gchar *text; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3444 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3445 /* force the return value to nul in case the following tests fail */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3446 if(buffer) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3447 buffer[0] = '\0'; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3448 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3449 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3450 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3451 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3452 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3453 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3454 GtkTextBuffer *tbuffer; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3455 GtkTextIter start, end; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3456 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3457 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3458 gtk_text_buffer_get_iter_at_offset(tbuffer, &start, startpoint); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3459 gtk_text_buffer_get_iter_at_offset(tbuffer, &end, startpoint + length); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3460 text = gtk_text_iter_get_text(&start, &end); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3461 if(text) /* Should this get freed? */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3462 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3463 if(buffer) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3464 strcpy(buffer, text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3465 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3466 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3467 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3468 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3469 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3470 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3471 * Obtains information about an MLE box. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3472 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3473 * handle: Handle to the MLE to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3474 * bytes: A pointer to a variable to return the total bytes. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3475 * lines: A pointer to a variable to return the number of lines. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3476 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3477 void dw_mle_get_size(HWND handle, unsigned long *bytes, unsigned long *lines) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3478 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3479 if(bytes) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3480 *bytes = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3481 if(lines) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3482 *lines = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3483 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3484 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3485 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3486 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3487 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3488 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3489 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3490 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tmp)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3491 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3492 if(bytes) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3493 *bytes = gtk_text_buffer_get_char_count(buffer); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3494 if(lines) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3495 *lines = gtk_text_buffer_get_line_count(buffer); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3496 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3497 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3498 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3499 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3500 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3501 * Deletes text from an MLE box. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3502 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3503 * handle: Handle to the MLE to be deleted from. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3504 * startpoint: Point to start deleting text. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3505 * length: Amount of text to be deleted. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3506 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3507 void dw_mle_delete(HWND handle, int startpoint, int length) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3508 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3509 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3510 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3511 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3512 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3513 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3514 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3515 GtkTextBuffer *tbuffer; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3516 GtkTextIter start, end; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3517 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3518 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3519 gtk_text_buffer_get_iter_at_offset(tbuffer, &start, startpoint); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3520 gtk_text_buffer_get_iter_at_offset(tbuffer, &end, startpoint + length); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3521 gtk_text_buffer_delete(tbuffer, &start, &end); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3522 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3523 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3524 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3525 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3526 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3527 * Clears all text from an MLE box. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3528 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3529 * handle: Handle to the MLE to be cleared. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3530 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3531 void dw_mle_clear(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3532 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3533 int length; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3534 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3535 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3536 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3537 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3538 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3539 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3540 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3541 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tmp)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3542 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3543 length = -1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3544 gtk_text_buffer_set_text(buffer, "", length); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3545 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3546 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3547 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3548 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3549 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3550 * Sets the visible line of an MLE box. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3551 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3552 * handle: Handle to the MLE. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3553 * line: Line to be visible. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3554 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3555 void dw_mle_set_visible(HWND handle, int line) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3556 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3557 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3558 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3559 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3560 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3561 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3562 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3563 GtkTextBuffer *tbuffer; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3564 GtkTextIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3565 GtkTextMark *mark = (GtkTextMark *)g_object_get_data(G_OBJECT(handle), "_dw_mark"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3566 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3567 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3568 gtk_text_buffer_get_iter_at_offset(tbuffer, &iter, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3569 gtk_text_iter_set_line(&iter, line); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3570 if(!mark) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3571 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3572 mark = gtk_text_buffer_create_mark(tbuffer, NULL, &iter, FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3573 g_object_set_data(G_OBJECT(handle), "_dw_mark", (gpointer)mark); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3574 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3575 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3576 gtk_text_buffer_move_mark(tbuffer, mark, &iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3577 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(tmp), mark, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3578 0, FALSE, 0, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3579 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3580 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3581 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3582 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3583 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3584 * Sets the editablity of an MLE box. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3585 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3586 * handle: Handle to the MLE. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3587 * state: TRUE if it can be edited, FALSE for readonly. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3588 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3589 void dw_mle_set_editable(HWND handle, int state) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3590 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3591 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3592 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3593 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3594 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3595 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3596 gtk_text_view_set_editable(GTK_TEXT_VIEW(tmp), state); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3597 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3598 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3599 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3600 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3601 * Sets the word wrap state of an MLE box. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3602 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3603 * handle: Handle to the MLE. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3604 * state: TRUE if it wraps, FALSE if it doesn't. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3605 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3606 void dw_mle_set_word_wrap(HWND handle, int state) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3607 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3608 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3609 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3610 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3611 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3612 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3613 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(tmp), state ? GTK_WRAP_WORD : GTK_WRAP_NONE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3614 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3615 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3616 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3617 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3618 * Sets the word auto complete state of an MLE box. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3619 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3620 * handle: Handle to the MLE. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3621 * state: Bitwise combination of DW_MLE_COMPLETE_TEXT/DASH/QUOTE |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3622 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3623 void dw_mle_set_auto_complete(HWND handle, int state) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3624 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3625 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3626 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3627 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3628 * Sets the current cursor position of an MLE box. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3629 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3630 * handle: Handle to the MLE to be positioned. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3631 * point: Point to position cursor. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3632 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3633 void dw_mle_set_cursor(HWND handle, int point) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3634 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3635 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3636 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3637 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3638 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3639 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3640 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3641 GtkTextBuffer *tbuffer; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3642 GtkTextIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3643 GtkTextMark *mark = (GtkTextMark *)g_object_get_data(G_OBJECT(handle), "_dw_mark"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3644 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3645 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3646 gtk_text_buffer_get_iter_at_offset(tbuffer, &iter, point); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3647 if(!mark) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3648 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3649 mark = gtk_text_buffer_create_mark(tbuffer, NULL, &iter, FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3650 g_object_set_data(G_OBJECT(handle), "_dw_mark", (gpointer)mark); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3651 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3652 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3653 gtk_text_buffer_move_mark(tbuffer, mark, &iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3654 gtk_text_buffer_place_cursor(tbuffer, &iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3655 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(tmp), mark, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3656 0, FALSE, 0, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3657 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3658 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3659 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3660 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3661 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3662 * Finds text in an MLE box. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3663 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3664 * handle: Handle to the MLE to be cleared. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3665 * text: Text to search for. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3666 * point: Start point of search. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3667 * flags: Search specific flags. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3668 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3669 int dw_mle_search(HWND handle, const char *text, int point, unsigned long flags) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3670 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3671 int retval = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3672 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3673 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3674 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3675 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3676 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3677 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3678 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3679 GtkTextBuffer *tbuffer; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3680 GtkTextIter iter, found; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3681 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3682 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3683 gtk_text_buffer_get_iter_at_offset(tbuffer, &iter, point); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3684 gtk_text_iter_forward_search(&iter, text, GTK_TEXT_SEARCH_TEXT_ONLY, &found, NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3685 retval = gtk_text_iter_get_offset(&found); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3686 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3687 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3688 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3689 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3690 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3691 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3692 * Stops redrawing of an MLE box. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3693 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3694 * handle: Handle to the MLE to freeze. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3695 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3696 void dw_mle_freeze(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3697 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3698 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3699 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3700 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3701 * Resumes redrawing of an MLE box. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3702 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3703 * handle: Handle to the MLE to thaw. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3704 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3705 void dw_mle_thaw(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3706 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3707 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3708 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3709 /* Internal function to update the progress bar |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3710 * while in an indeterminate state. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3711 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3712 gboolean _dw_update_progress_bar(gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3713 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3714 if(g_object_get_data(G_OBJECT(data), "_dw_alive")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3715 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3716 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(data)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3717 return TRUE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3718 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3719 return FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3720 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3721 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3722 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3723 * Sets the percent bar position. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3724 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3725 * handle: Handle to the percent bar to be set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3726 * position: Position of the percent bar withing the range. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3727 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3728 void dw_percent_set_pos(HWND handle, unsigned int position) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3729 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3730 if(position == DW_PERCENT_INDETERMINATE) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3731 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3732 /* Check if we are indeterminate already */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3733 if(!g_object_get_data(G_OBJECT(handle), "_dw_alive")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3734 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3735 /* If not become indeterminate... and start a timer to continue */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3736 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(handle)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3737 g_object_set_data(G_OBJECT(handle), "_dw_alive", GINT_TO_POINTER(1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3738 g_timeout_add(100, (GSourceFunc)_dw_update_progress_bar, (gpointer)handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3739 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3740 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3741 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3742 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3743 /* Cancel the existing timer if one is there */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3744 g_object_set_data(G_OBJECT(handle), "_dw_alive", NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3745 /* Set the position like normal */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3746 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(handle), (gfloat)position/100); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3747 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3748 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3749 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3750 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3751 * Returns the position of the slider. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3752 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3753 * handle: Handle to the slider to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3754 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3755 unsigned int dw_slider_get_pos(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3756 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3757 int val = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3758 GtkAdjustment *adjustment; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3759 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3760 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3761 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3762 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3763 adjustment = (GtkAdjustment *)g_object_get_data(G_OBJECT(handle), "_dw_adjustment"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3764 if(adjustment) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3765 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3766 int max = _round_value(gtk_adjustment_get_upper(adjustment)) - 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3767 int thisval = _round_value(gtk_adjustment_get_value(adjustment)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3768 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3769 if(gtk_orientable_get_orientation(GTK_ORIENTABLE(handle)) == GTK_ORIENTATION_VERTICAL) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3770 val = max - thisval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3771 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3772 val = thisval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3773 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3774 return val; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3775 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3776 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3777 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3778 * Sets the slider position. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3779 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3780 * handle: Handle to the slider to be set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3781 * position: Position of the slider withing the range. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3782 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3783 void dw_slider_set_pos(HWND handle, unsigned int position) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3784 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3785 GtkAdjustment *adjustment; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3786 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3787 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3788 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3789 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3790 adjustment = (GtkAdjustment *)g_object_get_data(G_OBJECT(handle), "_dw_adjustment"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3791 if(adjustment) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3792 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3793 int max = _round_value(gtk_adjustment_get_upper(adjustment)) - 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3794 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3795 if(gtk_orientable_get_orientation(GTK_ORIENTABLE(handle)) == GTK_ORIENTATION_VERTICAL) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3796 gtk_adjustment_set_value(adjustment, (gfloat)(max - position)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3797 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3798 gtk_adjustment_set_value(adjustment, (gfloat)position); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3799 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3800 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3801 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3802 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3803 * Returns the position of the scrollbar. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3804 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3805 * handle: Handle to the scrollbar to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3806 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3807 unsigned int dw_scrollbar_get_pos(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3808 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3809 int val = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3810 GtkAdjustment *adjustment; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3811 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3812 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3813 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3814 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3815 adjustment = (GtkAdjustment *)g_object_get_data(G_OBJECT(handle), "_dw_adjustment"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3816 if(adjustment) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3817 val = _round_value(gtk_adjustment_get_value(adjustment)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3818 return val; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3819 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3820 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3821 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3822 * Sets the scrollbar position. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3823 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3824 * handle: Handle to the scrollbar to be set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3825 * position: Position of the scrollbar withing the range. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3826 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3827 void dw_scrollbar_set_pos(HWND handle, unsigned int position) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3828 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3829 GtkAdjustment *adjustment; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3830 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3831 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3832 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3833 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3834 adjustment = (GtkAdjustment *)g_object_get_data(G_OBJECT(handle), "_dw_adjustment"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3835 if(adjustment) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3836 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3837 g_object_set_data(G_OBJECT(adjustment), "_dw_suppress_value_changed_event", GINT_TO_POINTER(1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3838 gtk_adjustment_set_value(adjustment, (gfloat)position); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3839 g_object_set_data(G_OBJECT(adjustment), "_dw_suppress_value_changed_event", GINT_TO_POINTER(0)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3840 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3841 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3842 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3843 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3844 * Sets the scrollbar range. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3845 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3846 * handle: Handle to the scrollbar to be set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3847 * range: Maximum range value. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3848 * visible: Visible area relative to the range. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3849 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3850 void API dw_scrollbar_set_range(HWND handle, unsigned int range, unsigned int visible) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3851 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3852 GtkAdjustment *adjustment; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3853 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3854 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3855 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3856 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3857 adjustment = (GtkAdjustment *)g_object_get_data(G_OBJECT(handle), "_dw_adjustment"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3858 if(adjustment) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3859 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3860 gtk_adjustment_set_upper(adjustment, (gdouble)range); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3861 gtk_adjustment_set_page_increment(adjustment,(gdouble)visible); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3862 gtk_adjustment_set_page_size(adjustment, (gdouble)visible); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3863 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3864 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3865 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3866 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3867 * Sets the spinbutton value. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3868 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3869 * handle: Handle to the spinbutton to be set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3870 * position: Current value of the spinbutton. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3871 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3872 void dw_spinbutton_set_pos(HWND handle, long position) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3873 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3874 gtk_spin_button_set_value(GTK_SPIN_BUTTON(handle), (gfloat)position); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3875 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3876 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3877 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3878 * Sets the spinbutton limits. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3879 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3880 * handle: Handle to the spinbutton to be set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3881 * position: Current value of the spinbutton. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3882 * position: Current value of the spinbutton. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3883 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3884 void dw_spinbutton_set_limits(HWND handle, long upper, long lower) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3885 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3886 long curval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3887 GtkAdjustment *adj; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3888 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3889 curval = dw_spinbutton_get_pos(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3890 adj = (GtkAdjustment *)gtk_adjustment_new((gfloat)curval, (gfloat)lower, (gfloat)upper, 1.0, 5.0, 0.0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3891 gtk_spin_button_set_adjustment(GTK_SPIN_BUTTON(handle), adj); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3892 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3893 * Set our internal relationships between the adjustment and the spinbutton |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3894 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3895 g_object_set_data(G_OBJECT(handle), "_dw_adjustment", (gpointer)adj); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3896 g_object_set_data(G_OBJECT(adj), "_dw_spinbutton", (gpointer)handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3897 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3898 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3899 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3900 * Sets the entryfield character limit. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3901 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3902 * handle: Handle to the spinbutton to be set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3903 * limit: Number of characters the entryfield will take. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3904 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3905 void dw_entryfield_set_limit(HWND handle, ULONG limit) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3906 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3907 gtk_entry_set_max_length(GTK_ENTRY(handle), limit); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3908 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3909 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3910 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3911 * Returns the current value of the spinbutton. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3912 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3913 * handle: Handle to the spinbutton to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3914 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3915 long dw_spinbutton_get_pos(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3916 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3917 return (long)gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(handle)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3918 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3919 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3920 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3921 * Returns the state of the checkbox. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3922 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3923 * handle: Handle to the checkbox to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3924 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3925 int dw_checkbox_get(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3926 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3927 return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(handle)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3928 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3929 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3930 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3931 * Sets the state of the checkbox. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3932 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3933 * handle: Handle to the checkbox to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3934 * value: TRUE for checked, FALSE for unchecked. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3935 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3936 void dw_checkbox_set(HWND handle, int value) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3937 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3938 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(handle), value); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3939 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3940 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3941 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3942 * Inserts an item into a tree window (widget) after another item. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3943 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3944 * handle: Handle to the tree to be inserted. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3945 * item: Handle to the item to be positioned after. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3946 * title: The text title of the entry. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3947 * icon: Handle to coresponding icon. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3948 * parent: Parent handle or 0 if root. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3949 * itemdata: Item specific data. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3950 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3951 HTREEITEM dw_tree_insert_after(HWND handle, HTREEITEM item, const char *title, HICN icon, HTREEITEM parent, void *itemdata) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3952 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3953 GtkWidget *tree; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3954 GtkTreeIter *iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3955 GtkTreeStore *store; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3956 GdkPixbuf *pixbuf; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3957 HTREEITEM retval = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3958 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3959 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3960 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3961 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3962 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3963 && GTK_IS_TREE_VIEW(tree) && |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3964 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3965 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3966 iter = (GtkTreeIter *)malloc(sizeof(GtkTreeIter)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3967 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3968 pixbuf = _find_pixbuf(icon, NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3969 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3970 gtk_tree_store_insert_after(store, iter, (GtkTreeIter *)parent, (GtkTreeIter *)item); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3971 gtk_tree_store_set (store, iter, 0, title, 1, pixbuf, 2, itemdata, 3, iter, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3972 retval = (HTREEITEM)iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3973 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3974 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3975 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3976 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3977 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3978 * Inserts an item into a tree window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3979 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3980 * handle: Handle to the tree to be inserted. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3981 * title: The text title of the entry. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3982 * icon: Handle to coresponding icon. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3983 * parent: Parent handle or 0 if root. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3984 * itemdata: Item specific data. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3985 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3986 HTREEITEM dw_tree_insert(HWND handle, const char *title, HICN icon, HTREEITEM parent, void *itemdata) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3987 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3988 GtkWidget *tree; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3989 GtkTreeIter *iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3990 GtkTreeStore *store; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3991 GdkPixbuf *pixbuf; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3992 HTREEITEM retval = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3993 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3994 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3995 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3996 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3997 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3998 && GTK_IS_TREE_VIEW(tree) && |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3999 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4000 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4001 iter = (GtkTreeIter *)malloc(sizeof(GtkTreeIter)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4002 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4003 pixbuf = _find_pixbuf(icon, NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4004 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4005 gtk_tree_store_append (store, iter, (GtkTreeIter *)parent); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4006 gtk_tree_store_set (store, iter, 0, title, 1, pixbuf, 2, itemdata, 3, iter, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4007 retval = (HTREEITEM)iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4008 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4009 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4010 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4011 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4012 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4013 * Sets the text and icon of an item in a tree window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4014 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4015 * handle: Handle to the tree containing the item. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4016 * item: Handle of the item to be modified. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4017 * title: The text title of the entry. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4018 * icon: Handle to coresponding icon. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4019 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4020 void dw_tree_item_change(HWND handle, HTREEITEM item, const char *title, HICN icon) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4021 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4022 GtkWidget *tree; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4023 GtkTreeStore *store; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4024 GdkPixbuf *pixbuf; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4025 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4026 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4027 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4028 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4029 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4030 && GTK_IS_TREE_VIEW(tree) && |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4031 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4032 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4033 pixbuf = _find_pixbuf(icon, NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4034 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4035 gtk_tree_store_set(store, (GtkTreeIter *)item, 0, title, 1, pixbuf, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4036 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4037 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4038 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4039 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4040 * Sets the item data of a tree item. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4041 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4042 * handle: Handle to the tree containing the item. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4043 * item: Handle of the item to be modified. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4044 * itemdata: User defined data to be associated with item. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4045 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4046 void dw_tree_item_set_data(HWND handle, HTREEITEM item, void *itemdata) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4047 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4048 GtkWidget *tree; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4049 GtkTreeStore *store; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4050 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4051 if(!handle || !item) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4052 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4053 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4054 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4055 && GTK_IS_TREE_VIEW(tree) && |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4056 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4057 gtk_tree_store_set(store, (GtkTreeIter *)item, 2, itemdata, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4058 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4059 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4060 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4061 * Gets the text an item in a tree window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4062 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4063 * handle: Handle to the tree containing the item. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4064 * item: Handle of the item to be modified. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4065 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4066 char * API dw_tree_get_title(HWND handle, HTREEITEM item) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4067 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4068 char *text = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4069 GtkWidget *tree; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4070 GtkTreeModel *store; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4071 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4072 if(!handle || !item) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4073 return text; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4074 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4075 tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4076 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4077 if(tree && GTK_IS_TREE_VIEW(tree) && |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4078 (store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4079 gtk_tree_model_get(store, (GtkTreeIter *)item, _DW_DATA_TYPE_STRING, &text, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4080 if(text) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4081 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4082 char *temp = text; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4083 text = strdup(temp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4084 g_free(temp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4085 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4086 return text; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4087 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4088 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4089 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4090 * Gets the text an item in a tree window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4091 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4092 * handle: Handle to the tree containing the item. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4093 * item: Handle of the item to be modified. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4094 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4095 HTREEITEM API dw_tree_get_parent(HWND handle, HTREEITEM item) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4096 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4097 HTREEITEM parent = (HTREEITEM)0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4098 GtkWidget *tree; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4099 GtkTreeModel *store; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4100 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4101 if(!handle || !item) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4102 return parent; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4103 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4104 tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4105 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4106 if(tree && GTK_IS_TREE_VIEW(tree) && |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4107 (store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4108 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4109 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4110 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4111 if(gtk_tree_model_iter_parent(store, &iter, (GtkTreeIter *)item)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4112 gtk_tree_model_get(store, &iter, 3, &parent, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4113 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4114 return parent; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4115 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4116 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4117 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4118 * Gets the item data of a tree item. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4119 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4120 * handle: Handle to the tree containing the item. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4121 * item: Handle of the item to be modified. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4122 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4123 void *dw_tree_item_get_data(HWND handle, HTREEITEM item) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4124 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4125 void *ret = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4126 GtkWidget *tree; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4127 GtkTreeModel *store; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4128 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4129 if(!handle || !item) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4130 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4131 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4132 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4133 && GTK_IS_TREE_VIEW(tree) && |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4134 (store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4135 gtk_tree_model_get(store, (GtkTreeIter *)item, 2, &ret, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4136 return ret; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4137 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4138 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4139 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4140 * Sets this item as the active selection. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4141 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4142 * handle: Handle to the tree window (widget) to be selected. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4143 * item: Handle to the item to be selected. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4144 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4145 void dw_tree_item_select(HWND handle, HTREEITEM item) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4146 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4147 GtkWidget *tree; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4148 GtkTreeStore *store; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4149 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4150 if(!handle || !item) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4151 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4152 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4153 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4154 && GTK_IS_TREE_VIEW(tree) && |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4155 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4156 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4157 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), (GtkTreeIter *)item); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4158 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4159 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4160 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree), path, NULL, FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4161 gtk_tree_selection_select_iter(sel, (GtkTreeIter *)item); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4162 gtk_tree_path_free(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4163 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4164 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4165 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4166 static void _dw_recursive_free(GtkTreeModel *store, GtkTreeIter parent) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4167 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4168 void *data; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4169 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4170 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4171 gtk_tree_model_get(store, &parent, 3, &data, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4172 if(data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4173 free(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4174 gtk_tree_store_set(GTK_TREE_STORE(store), &parent, 3, NULL, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4175 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4176 if(gtk_tree_model_iter_children(store, &iter, &parent)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4177 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4178 do { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4179 _dw_recursive_free(GTK_TREE_MODEL(store), iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4180 } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4181 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4182 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4183 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4184 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4185 * Removes all nodes from a tree. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4186 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4187 * handle: Handle to the window (widget) to be cleared. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4188 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4189 void dw_tree_clear(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4190 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4191 GtkWidget *tree; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4192 GtkTreeStore *store; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4193 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4194 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4195 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4196 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4197 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4198 && GTK_IS_TREE_VIEW(tree) && |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4199 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4200 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4201 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4202 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4203 if(gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4204 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4205 do { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4206 _dw_recursive_free(GTK_TREE_MODEL(store), iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4207 } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4208 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4209 gtk_tree_store_clear(store); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4210 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4211 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4212 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4213 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4214 * Expands a node on a tree. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4215 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4216 * handle: Handle to the tree window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4217 * item: Handle to node to be expanded. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4218 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4219 void dw_tree_item_expand(HWND handle, HTREEITEM item) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4220 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4221 GtkWidget *tree; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4222 GtkTreeStore *store; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4223 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4224 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4225 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4226 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4227 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4228 && GTK_IS_TREE_VIEW(tree) && |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4229 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4230 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4231 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), (GtkTreeIter *)item); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4232 gtk_tree_view_expand_row(GTK_TREE_VIEW(tree), path, FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4233 gtk_tree_path_free(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4234 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4235 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4236 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4237 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4238 * Collapses a node on a tree. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4239 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4240 * handle: Handle to the tree window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4241 * item: Handle to node to be collapsed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4242 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4243 void dw_tree_item_collapse(HWND handle, HTREEITEM item) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4244 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4245 GtkWidget *tree; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4246 GtkTreeStore *store; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4247 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4248 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4249 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4250 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4251 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4252 && GTK_IS_TREE_VIEW(tree) && |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4253 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4254 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4255 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), (GtkTreeIter *)item); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4256 gtk_tree_view_collapse_row(GTK_TREE_VIEW(tree), path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4257 gtk_tree_path_free(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4258 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4259 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4260 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4261 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4262 * Removes a node from a tree. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4263 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4264 * handle: Handle to the window (widget) to be cleared. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4265 * item: Handle to node to be deleted. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4266 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4267 void dw_tree_item_delete(HWND handle, HTREEITEM item) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4268 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4269 GtkWidget *tree; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4270 GtkTreeStore *store; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4271 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4272 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4273 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4274 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4275 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4276 && GTK_IS_TREE_VIEW(tree) && |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4277 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4278 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4279 gtk_tree_store_remove(store, (GtkTreeIter *)item); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4280 free(item); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4281 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4282 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4283 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4284 #define _DW_CONTAINER_STORE_EXTRA 2 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4285 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4286 static int _dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator, int extra) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4287 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4288 int z; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4289 char numbuf[25] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4290 GtkWidget *tree; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4291 GtkListStore *store; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4292 GtkTreeViewColumn *col; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4293 GtkCellRenderer *rend; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4294 GtkTreeSelection *sel; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4295 GType *array = calloc(count + _DW_CONTAINER_STORE_EXTRA + 1, sizeof(GType)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4296 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4297 /* Save some of the info so it is easily accessible */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4298 g_object_set_data(G_OBJECT(handle), "_dw_cont_columns", GINT_TO_POINTER(count)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4299 g_object_set_data(G_OBJECT(handle), "_dw_cont_extra", GINT_TO_POINTER(extra)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4300 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4301 /* First param is row title */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4302 array[0] = G_TYPE_STRING; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4303 /* Second param is row data */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4304 array[1] = G_TYPE_POINTER; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4305 array[2] = G_TYPE_POINTER; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4306 /* First loop... create array to create the store */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4307 for(z=0;z<count;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4308 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4309 if(z == 0 && flags[z] & DW_CFA_STRINGANDICON) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4310 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4311 array[_DW_CONTAINER_STORE_EXTRA] = GDK_TYPE_PIXBUF; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4312 array[_DW_CONTAINER_STORE_EXTRA+1] = G_TYPE_STRING; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4313 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4314 else if(flags[z] & DW_CFA_BITMAPORICON) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4315 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4316 array[z+_DW_CONTAINER_STORE_EXTRA+1] = GDK_TYPE_PIXBUF; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4317 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4318 else if(flags[z] & DW_CFA_STRING) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4319 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4320 array[z+_DW_CONTAINER_STORE_EXTRA+1] = G_TYPE_STRING; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4321 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4322 else if(flags[z] & DW_CFA_ULONG) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4323 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4324 array[z+_DW_CONTAINER_STORE_EXTRA+1] = G_TYPE_ULONG; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4325 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4326 else if(flags[z] & DW_CFA_TIME) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4327 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4328 array[z+_DW_CONTAINER_STORE_EXTRA+1] = G_TYPE_STRING; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4329 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4330 else if(flags[z] & DW_CFA_DATE) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4331 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4332 array[z+_DW_CONTAINER_STORE_EXTRA+1] = G_TYPE_STRING; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4333 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4334 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4335 /* Create the store and then the tree */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4336 store = gtk_list_store_newv(count + _DW_CONTAINER_STORE_EXTRA + 1, array); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4337 tree = _tree_setup(handle, GTK_TREE_MODEL(store)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4338 g_object_set_data(G_OBJECT(tree), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4339 /* Second loop... create the columns */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4340 for(z=0;z<count;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4341 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4342 snprintf(numbuf, 24, "_dw_cont_col%d", z); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4343 g_object_set_data(G_OBJECT(tree), numbuf, GINT_TO_POINTER(flags[z])); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4344 col = gtk_tree_view_column_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4345 rend = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4346 void **params = calloc(sizeof(void *), 3); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4347 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4348 if(z == 0 && flags[z] & DW_CFA_STRINGANDICON) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4349 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4350 rend = gtk_cell_renderer_pixbuf_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4351 gtk_tree_view_column_pack_start(col, rend, FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4352 gtk_tree_view_column_add_attribute(col, rend, "pixbuf", _DW_CONTAINER_STORE_EXTRA); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4353 rend = gtk_cell_renderer_text_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4354 gtk_tree_view_column_pack_start(col, rend, TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4355 gtk_tree_view_column_add_attribute(col, rend, "text", _DW_CONTAINER_STORE_EXTRA+1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4356 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4357 else if(flags[z] & DW_CFA_BITMAPORICON) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4358 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4359 rend = gtk_cell_renderer_pixbuf_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4360 gtk_tree_view_column_pack_start(col, rend, FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4361 gtk_tree_view_column_add_attribute(col, rend, "pixbuf", z+_DW_CONTAINER_STORE_EXTRA+1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4362 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4363 else if(flags[z] & DW_CFA_STRING) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4364 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4365 rend = gtk_cell_renderer_text_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4366 gtk_tree_view_column_pack_start(col, rend, TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4367 gtk_tree_view_column_add_attribute(col, rend, "text", z+_DW_CONTAINER_STORE_EXTRA+1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4368 gtk_tree_view_column_set_resizable(col, TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4369 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4370 else if(flags[z] & DW_CFA_ULONG) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4371 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4372 rend = gtk_cell_renderer_text_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4373 gtk_tree_view_column_pack_start(col, rend, TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4374 gtk_tree_view_column_add_attribute(col, rend, "text", z+_DW_CONTAINER_STORE_EXTRA+1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4375 gtk_tree_view_column_set_resizable(col, TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4376 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4377 else if(flags[z] & DW_CFA_TIME) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4378 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4379 rend = gtk_cell_renderer_text_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4380 gtk_tree_view_column_pack_start(col, rend, TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4381 gtk_tree_view_column_add_attribute(col, rend, "text", z+_DW_CONTAINER_STORE_EXTRA+1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4382 gtk_tree_view_column_set_resizable(col, TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4383 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4384 else if(flags[z] & DW_CFA_DATE) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4385 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4386 rend = gtk_cell_renderer_text_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4387 gtk_tree_view_column_pack_start(col, rend, TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4388 gtk_tree_view_column_add_attribute(col, rend, "text", z+_DW_CONTAINER_STORE_EXTRA+1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4389 gtk_tree_view_column_set_resizable(col, TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4390 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4391 g_object_set_data(G_OBJECT(col), "_dw_column", GINT_TO_POINTER(z)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4392 params[2] = tree; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4393 g_signal_connect_data(G_OBJECT(col), "clicked", G_CALLBACK(_column_click_event), (gpointer)params, _dw_signal_disconnect, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4394 gtk_tree_view_column_set_title(col, titles[z]); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4395 if(flags[z] & DW_CFA_RIGHT) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4396 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4397 gtk_tree_view_column_set_alignment(col, 1.0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4398 if(rend) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4399 gtk_cell_renderer_set_alignment(rend, 1.0, 0.5); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4400 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4401 else if(flags[z] & DW_CFA_CENTER) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4402 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4403 gtk_tree_view_column_set_alignment(col, 0.5); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4404 if(rend) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4405 gtk_cell_renderer_set_alignment(rend, 0.5, 0.5); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4406 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4407 gtk_tree_view_append_column(GTK_TREE_VIEW (tree), col); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4408 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4409 /* Finish up */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4410 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4411 gtk_tree_view_set_headers_clickable(GTK_TREE_VIEW(tree), TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4412 gtk_tree_view_set_rubber_banding(GTK_TREE_VIEW(tree), TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4413 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4414 if(g_object_get_data(G_OBJECT(handle), "_dw_multi_sel")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4415 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4416 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4417 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4418 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4419 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4420 gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4421 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4422 gtk_widget_show(tree); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4423 free(array); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4424 if(_DWDefaultFont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4425 dw_window_set_font(handle, _DWDefaultFont); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4426 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4427 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4428 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4429 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4430 * Sets up the container columns. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4431 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4432 * handle: Handle to the container to be configured. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4433 * flags: An array of unsigned longs with column flags. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4434 * titles: An array of strings with column text titles. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4435 * count: The number of columns (this should match the arrays). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4436 * separator: The column number that contains the main separator. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4437 * (this item may only be used in OS/2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4438 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4439 int dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4440 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4441 return _dw_container_setup(handle, flags, titles, count, separator, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4442 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4443 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4444 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4445 * Configures the main filesystem columnn title for localization. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4446 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4447 * handle: Handle to the container to be configured. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4448 * title: The title to be displayed in the main column. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4449 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4450 void API dw_filesystem_set_column_title(HWND handle, const char *title) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4451 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4452 char *newtitle = strdup(title ? title : ""); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4453 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4454 g_object_set_data(G_OBJECT(handle), "_dw_coltitle", newtitle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4455 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4456 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4457 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4458 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4459 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4460 * handle: Handle to the container to be configured. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4461 * flags: An array of unsigned longs with column flags. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4462 * titles: An array of strings with column text titles. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4463 * count: The number of columns (this should match the arrays). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4464 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4465 int dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4466 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4467 char **newtitles = malloc(sizeof(char *) * (count + 1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4468 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4469 char *coltitle = (char *)g_object_get_data(G_OBJECT(handle), "_dw_coltitle"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4470 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4471 newtitles[0] = coltitle ? coltitle : "Filename"; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4472 newflags[0] = DW_CFA_STRINGANDICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4473 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4474 memcpy(&newtitles[1], titles, sizeof(char *) * count); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4475 memcpy(&newflags[1], flags, sizeof(unsigned long) * count); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4476 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4477 _dw_container_setup(handle, newflags, newtitles, count + 1, 1, 1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4478 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4479 if(coltitle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4480 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4481 g_object_set_data(G_OBJECT(handle), "_dw_coltitle", NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4482 free(coltitle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4483 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4484 if ( newtitles) free(newtitles); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4485 if ( newflags ) free(newflags); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4486 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4487 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4488 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4489 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4490 * Obtains an icon from a module (or header in GTK). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4491 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4492 * module: Handle to module (DLL) in OS/2 and Windows. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4493 * id: A unsigned long id int the resources on OS/2 and |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4494 * Windows, on GTK this is converted to a pointer |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4495 * to an embedded XPM. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4496 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4497 HICN dw_icon_load(unsigned long module, unsigned long id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4498 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4499 return (HICN)id; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4500 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4501 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4502 /* Internal function to keep HICNs from getting too big */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4503 GdkPixbuf *_icon_resize(GdkPixbuf *ret) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4504 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4505 if(ret) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4506 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4507 int pwidth = gdk_pixbuf_get_width(ret); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4508 int pheight = gdk_pixbuf_get_height(ret); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4509 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4510 if(pwidth > 24 || pheight > 24) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4511 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4512 GdkPixbuf *orig = ret; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4513 ret = gdk_pixbuf_scale_simple(ret, pwidth > 24 ? 24 : pwidth, pheight > 24 ? 24 : pheight, GDK_INTERP_BILINEAR); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4514 g_object_unref(G_OBJECT(orig)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4515 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4516 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4517 return ret; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4518 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4519 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4520 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4521 * Obtains an icon from a file. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4522 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4523 * filename: Name of the file, omit extention to have |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4524 * DW pick the appropriate file extension. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4525 * (ICO on OS/2 or Windows, XPM on Unix) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4526 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4527 HICN API dw_icon_load_from_file(const char *filename) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4528 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4529 char *file = alloca(strlen(filename) + 6); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4530 int i, found_ext = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4531 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4532 if (!file) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4533 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4534 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4535 strcpy(file, filename); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4536 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4537 /* check if we can read from this file (it exists and read permission) */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4538 if (access(file, 04) != 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4539 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4540 /* Try with various extentions */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4541 for ( i = 0; i < NUM_EXTS; i++ ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4542 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4543 strcpy( file, filename ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4544 strcat( file, image_exts[i] ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4545 if ( access( file, 04 ) == 0 ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4546 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4547 found_ext = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4548 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4549 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4550 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4551 if ( found_ext == 0 ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4552 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4553 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4554 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4555 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4556 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4557 return _icon_resize(gdk_pixbuf_new_from_file(file, NULL)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4558 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4559 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4560 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4561 * Obtains an icon from data. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4562 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4563 * data: Source of data for image. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4564 * len: length of data |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4565 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4566 HICN API dw_icon_load_from_data(const char *data, int len) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4567 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4568 int fd, written = -1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4569 char template[] = "/tmp/dwiconXXXXXX"; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4570 HICN ret = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4571 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4572 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4573 * A real hack; create a temporary file and write the contents |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4574 * of the data to the file |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4575 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4576 if((fd = mkstemp(template)) != -1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4577 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4578 written = write(fd, data, len); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4579 close(fd); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4580 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4581 /* Bail if we couldn't write full file */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4582 if(fd == -1 || written != len) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4583 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4584 ret = _icon_resize(gdk_pixbuf_new_from_file(template, NULL)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4585 unlink(template); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4586 return ret; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4587 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4588 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4589 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4590 * Frees a loaded resource in OS/2 and Windows. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4591 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4592 * handle: Handle to icon returned by dw_icon_load(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4593 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4594 void dw_icon_free(HICN handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4595 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4596 int iicon = GPOINTER_TO_INT(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4597 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4598 if(iicon > 65535) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4599 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4600 g_object_unref(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4601 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4602 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4603 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4604 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4605 * Allocates memory used to populate a container. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4606 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4607 * handle: Handle to the container window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4608 * rowcount: The number of items to be populated. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4609 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4610 void *dw_container_alloc(HWND handle, int rowcount) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4611 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4612 int z, prevrowcount = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4613 GtkWidget *cont; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4614 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4615 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4616 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4617 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4618 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4619 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4620 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4621 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4622 if(store) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4623 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4624 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4625 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4626 prevrowcount = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), "_dw_rowcount")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4627 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4628 for(z=0;z<rowcount;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4629 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4630 gtk_list_store_append(store, &iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4631 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4632 g_object_set_data(G_OBJECT(cont), "_dw_insertpos", GINT_TO_POINTER(prevrowcount)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4633 g_object_set_data(G_OBJECT(cont), "_dw_rowcount", GINT_TO_POINTER(rowcount + prevrowcount)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4634 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4635 return (void *)cont; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4636 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4637 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4638 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4639 * Internal representation of dw_container_set_item() extracted so we can pass |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4640 * two data pointers; icon and text for dw_filesystem_set_item(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4641 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4642 void _dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4643 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4644 char numbuf[25] = {0}, textbuffer[101] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4645 int flag = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4646 GtkWidget *cont; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4647 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4648 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4649 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4650 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4651 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4652 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4653 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4654 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4655 if(store) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4656 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4657 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4658 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4659 snprintf(numbuf, 24, "_dw_cont_col%d", column); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4660 flag = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), numbuf)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4661 if(pointer) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4662 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4663 row += GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), "_dw_insertpos")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4664 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4665 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4666 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, row)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4667 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4668 if(flag & DW_CFA_STRINGANDICON) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4669 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4670 void **thisdata = (void **)data; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4671 HICN hicon = data ? *((HICN *)thisdata[0]) : 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4672 char *tmp = data ? (char *)thisdata[1] : NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4673 GdkPixbuf *pixbuf = hicon ? _find_pixbuf(hicon, NULL, NULL) : NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4674 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4675 gtk_list_store_set(store, &iter, _DW_CONTAINER_STORE_EXTRA, pixbuf, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4676 gtk_list_store_set(store, &iter, _DW_CONTAINER_STORE_EXTRA + 1, tmp, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4677 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4678 else if(flag & DW_CFA_BITMAPORICON) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4679 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4680 HICN hicon = data ? *((HICN *)data) : 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4681 GdkPixbuf *pixbuf = hicon ? _find_pixbuf(hicon, NULL, NULL) : NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4682 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4683 gtk_list_store_set(store, &iter, column + _DW_CONTAINER_STORE_EXTRA + 1, pixbuf, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4684 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4685 else if(flag & DW_CFA_STRING) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4686 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4687 char *tmp = data ? *((char **)data) : NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4688 gtk_list_store_set(store, &iter, column + _DW_CONTAINER_STORE_EXTRA + 1, tmp, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4689 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4690 else if(flag & DW_CFA_ULONG) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4691 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4692 ULONG tmp = data ? *((ULONG *)data): 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4693 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4694 gtk_list_store_set(store, &iter, column + _DW_CONTAINER_STORE_EXTRA + 1, tmp, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4695 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4696 else if(flag & DW_CFA_DATE) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4697 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4698 if(data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4699 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4700 struct tm curtm; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4701 CDATE cdate = *((CDATE *)data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4702 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4703 memset( &curtm, 0, sizeof(curtm) ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4704 curtm.tm_mday = cdate.day; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4705 curtm.tm_mon = cdate.month - 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4706 curtm.tm_year = cdate.year - 1900; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4707 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4708 strftime(textbuffer, 100, "%x", &curtm); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4709 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4710 gtk_list_store_set(store, &iter, column + _DW_CONTAINER_STORE_EXTRA + 1, textbuffer, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4711 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4712 else if(flag & DW_CFA_TIME) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4713 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4714 if(data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4715 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4716 struct tm curtm; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4717 CTIME ctime = *((CTIME *)data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4718 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4719 memset( &curtm, 0, sizeof(curtm) ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4720 curtm.tm_hour = ctime.hours; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4721 curtm.tm_min = ctime.minutes; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4722 curtm.tm_sec = ctime.seconds; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4723 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4724 strftime(textbuffer, 100, "%X", &curtm); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4725 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4726 gtk_list_store_set(store, &iter, column + _DW_CONTAINER_STORE_EXTRA + 1, textbuffer, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4727 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4728 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4729 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4730 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4731 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4732 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4733 * Sets an item in specified row and column to the given data. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4734 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4735 * handle: Handle to the container window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4736 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4737 * column: Zero based column of data being set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4738 * row: Zero based row of data being set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4739 * data: Pointer to the data to be added. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4740 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4741 void dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4742 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4743 _dw_container_set_item(handle, pointer, column, row, data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4744 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4745 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4746 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4747 * Changes an existing item in specified row and column to the given data. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4748 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4749 * handle: Handle to the container window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4750 * column: Zero based column of data being set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4751 * row: Zero based row of data being set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4752 * data: Pointer to the data to be added. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4753 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4754 void dw_container_change_item(HWND handle, int column, int row, void *data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4755 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4756 _dw_container_set_item(handle, NULL, column, row, data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4757 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4758 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4759 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4760 * Changes an existing item in specified row and column to the given data. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4761 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4762 * handle: Handle to the container window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4763 * column: Zero based column of data being set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4764 * row: Zero based row of data being set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4765 * data: Pointer to the data to be added. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4766 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4767 void API dw_filesystem_change_item(HWND handle, int column, int row, void *data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4768 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4769 dw_filesystem_set_item(handle, NULL, column, row, data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4770 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4771 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4772 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4773 * Changes an item in specified row and column to the given data. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4774 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4775 * handle: Handle to the container window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4776 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4777 * column: Zero based column of data being set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4778 * row: Zero based row of data being set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4779 * data: Pointer to the data to be added. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4780 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4781 void API dw_filesystem_change_file(HWND handle, int row, const char *filename, HICN icon) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4782 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4783 dw_filesystem_set_file(handle, NULL, row, filename, icon); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4784 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4785 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4786 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4787 * Sets an item in specified row and column to the given data. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4788 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4789 * handle: Handle to the container window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4790 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4791 * column: Zero based column of data being set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4792 * row: Zero based row of data being set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4793 * data: Pointer to the data to be added. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4794 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4795 void dw_filesystem_set_file(HWND handle, void *pointer, int row, const char *filename, HICN icon) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4796 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4797 void *data[2] = { (void *)&icon, (void *)filename }; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4798 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4799 _dw_container_set_item(handle, pointer, 0, row, (void *)data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4800 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4801 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4802 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4803 * Sets an item in specified row and column to the given data. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4804 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4805 * handle: Handle to the container window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4806 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4807 * column: Zero based column of data being set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4808 * row: Zero based row of data being set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4809 * data: Pointer to the data to be added. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4810 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4811 void dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4812 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4813 _dw_container_set_item(handle, pointer, column + 1, row, data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4814 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4815 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4816 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4817 * Gets column type for a container column |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4818 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4819 * handle: Handle to the container window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4820 * column: Zero based column. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4821 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4822 int dw_container_get_column_type(HWND handle, int column) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4823 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4824 char numbuf[25] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4825 int flag, rc = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4826 GtkWidget *cont = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4827 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4828 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4829 if(!cont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4830 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4831 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4832 snprintf(numbuf, 24, "_dw_cont_col%d", column); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4833 flag = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), numbuf)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4834 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4835 if(flag & DW_CFA_BITMAPORICON) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4836 rc = DW_CFA_BITMAPORICON; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4837 else if(flag & DW_CFA_STRING) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4838 rc = DW_CFA_STRING; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4839 else if(flag & DW_CFA_ULONG) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4840 rc = DW_CFA_ULONG; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4841 else if(flag & DW_CFA_DATE) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4842 rc = DW_CFA_DATE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4843 else if(flag & DW_CFA_TIME) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4844 rc = DW_CFA_TIME; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4845 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4846 rc = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4847 return rc; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4848 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4849 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4850 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4851 * Gets column type for a filesystem container column |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4852 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4853 * handle: Handle to the container window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4854 * column: Zero based column. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4855 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4856 int API dw_filesystem_get_column_type(HWND handle, int column) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4857 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4858 return dw_container_get_column_type( handle, column + 1 ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4859 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4860 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4861 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4862 * Sets the alternating row colors for container window (widget) handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4863 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4864 * handle: The window (widget) handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4865 * oddcolor: Odd row background color in DW_RGB format or a default color index. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4866 * evencolor: Even row background color in DW_RGB format or a default color index. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4867 * DW_RGB_TRANSPARENT will disable coloring rows. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4868 * DW_CLR_DEFAULT will use the system default alternating row colors. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4869 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4870 void API dw_container_set_stripe(HWND handle, unsigned long oddcolor, unsigned long evencolor) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4871 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4872 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4873 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4874 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4875 * Sets the width of a column in the container. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4876 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4877 * handle: Handle to window (widget) of container. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4878 * column: Zero based column of width being set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4879 * width: Width of column in pixels. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4880 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4881 void dw_container_set_column_width(HWND handle, int column, int width) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4882 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4883 GtkWidget *cont; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4884 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4885 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4886 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4887 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4888 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4889 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4890 GtkTreeViewColumn *col = gtk_tree_view_get_column(GTK_TREE_VIEW(cont), column); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4891 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4892 if(col && GTK_IS_TREE_VIEW_COLUMN(col)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4893 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4894 gtk_tree_view_column_set_fixed_width(GTK_TREE_VIEW_COLUMN(col), width); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4895 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4896 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4897 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4898 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4899 /* Internal version for both */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4900 void _dw_container_set_row_data(HWND handle, void *pointer, int row, int type, void *data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4901 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4902 GtkWidget *cont = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4903 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4904 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4905 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4906 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4907 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4908 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4909 if(store) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4910 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4911 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4912 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4913 if(pointer) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4914 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4915 row += GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), "_dw_insertpos")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4916 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4917 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4918 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, row)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4919 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4920 gtk_list_store_set(store, &iter, type, (gpointer)data, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4921 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4922 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4923 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4924 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4925 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4926 * Sets the title of a row in the container. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4927 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4928 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4929 * row: Zero based row of data being set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4930 * title: String title of the item. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4931 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4932 void dw_container_set_row_title(void *pointer, int row, const char *title) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4933 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4934 _dw_container_set_row_data(pointer, pointer, row, _DW_DATA_TYPE_STRING, (void *)title); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4935 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4936 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4937 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4938 * Changes the title of a row already inserted in the container. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4939 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4940 * handle: Handle to window (widget) of container. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4941 * row: Zero based row of data being set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4942 * title: String title of the item. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4943 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4944 void dw_container_change_row_title(HWND handle, int row, const char *title) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4945 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4946 _dw_container_set_row_data(handle, NULL, row, _DW_DATA_TYPE_STRING, (void *)title); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4947 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4948 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4949 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4950 * Sets the data of a row in the container. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4951 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4952 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4953 * row: Zero based row of data being set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4954 * data: Data pointer. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4955 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4956 void dw_container_set_row_data(void *pointer, int row, void *data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4957 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4958 _dw_container_set_row_data(pointer, pointer, row, _DW_DATA_TYPE_POINTER, data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4959 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4960 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4961 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4962 * Changes the data of a row already inserted in the container. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4963 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4964 * handle: Handle to window (widget) of container. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4965 * row: Zero based row of data being set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4966 * data: Data pointer. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4967 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4968 void dw_container_change_row_data(HWND handle, int row, void *data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4969 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4970 _dw_container_set_row_data(handle, NULL, row, _DW_DATA_TYPE_POINTER, data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4971 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4972 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4973 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4974 * Sets the title of a row in the container. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4975 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4976 * handle: Handle to the container window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4977 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4978 * rowcount: The number of rows to be inserted. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4979 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4980 void dw_container_insert(HWND handle, void *pointer, int rowcount) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4981 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4982 /* Don't need to do anything here */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4983 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4984 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4985 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4986 * Removes the first x rows from a container. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4987 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4988 * handle: Handle to the window (widget) to be deleted from. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4989 * rowcount: The number of rows to be deleted. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4990 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4991 void dw_container_delete(HWND handle, int rowcount) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4992 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4993 GtkWidget *cont; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4994 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4995 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4996 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4997 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4998 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4999 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5000 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5001 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5002 if(store) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5003 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5004 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5005 int rows, z; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5006 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5007 rows = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), "_dw_rowcount")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5008 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5009 for(z=0;z<rowcount;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5010 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5011 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, 0)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5012 gtk_list_store_remove(store, &iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5013 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5014 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5015 if(rows - rowcount < 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5016 rows = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5017 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5018 rows -= rowcount; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5019 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5020 g_object_set_data(G_OBJECT(cont), "_dw_rowcount", GINT_TO_POINTER(rows)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5021 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5022 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5023 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5024 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5025 * Removes all rows from a container. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5026 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5027 * handle: Handle to the window (widget) to be cleared. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5028 * redraw: TRUE to cause the container to redraw immediately. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5029 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5030 void dw_container_clear(HWND handle, int redraw) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5031 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5032 GtkWidget *cont; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5033 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5034 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5035 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5036 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5037 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5038 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5039 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5040 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5041 if(store) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5042 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5043 g_object_set_data(G_OBJECT(cont), "_dw_rowcount", GINT_TO_POINTER(0)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5044 g_object_set_data(G_OBJECT(cont), "_dw_insertpos", GINT_TO_POINTER(0)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5045 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5046 gtk_list_store_clear(store); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5047 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5048 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5049 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5050 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5051 * Scrolls container up or down. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5052 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5053 * handle: Handle to the window (widget) to be scrolled. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5054 * direction: DW_SCROLL_UP, DW_SCROLL_DOWN, DW_SCROLL_TOP or |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5055 * DW_SCROLL_BOTTOM. (rows is ignored for last two) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5056 * rows: The number of rows to be scrolled. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5057 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5058 void dw_container_scroll(HWND handle, int direction, long rows) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5059 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5060 GtkWidget *cont; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5061 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5062 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5063 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5064 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5065 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5066 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5067 GtkAdjustment *adjust = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(cont)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5068 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5069 if(adjust) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5070 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5071 gint rowcount = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), "_dw_rowcount")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5072 gdouble currpos = gtk_adjustment_get_value(adjust); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5073 gdouble upper = gtk_adjustment_get_upper(adjust); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5074 gdouble lower = gtk_adjustment_get_lower(adjust); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5075 gdouble change; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5076 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5077 /* Safety check */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5078 if(rowcount < 1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5079 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5080 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5081 change = ((gdouble)rows/(gdouble)rowcount) * (upper - lower); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5082 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5083 switch(direction) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5084 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5085 case DW_SCROLL_TOP: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5086 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5087 gtk_adjustment_set_value(adjust, lower); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5088 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5089 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5090 case DW_SCROLL_BOTTOM: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5091 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5092 gtk_adjustment_set_value(adjust, upper); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5093 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5094 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5095 case DW_SCROLL_UP: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5096 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5097 gdouble newpos = currpos - change; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5098 if(newpos < lower) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5099 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5100 newpos = lower; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5101 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5102 gtk_adjustment_set_value(adjust, newpos); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5103 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5104 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5105 case DW_SCROLL_DOWN: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5106 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5107 gdouble newpos = currpos + change; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5108 if(newpos > upper) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5109 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5110 newpos = upper; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5111 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5112 gtk_adjustment_set_value(adjust, newpos); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5113 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5114 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5115 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5116 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5117 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5118 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5119 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5120 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5121 * Starts a new query of a container. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5122 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5123 * handle: Handle to the window (widget) to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5124 * flags: If this parameter is DW_CRA_SELECTED it will only |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5125 * return items that are currently selected. Otherwise |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5126 * it will return all records in the container. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5127 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5128 char *dw_container_query_start(HWND handle, unsigned long flags) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5129 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5130 GtkWidget *cont; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5131 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5132 char *retval = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5133 int type = flags & DW_CR_RETDATA ? _DW_DATA_TYPE_POINTER : _DW_DATA_TYPE_STRING; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5134 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5135 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5136 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5137 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5138 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5139 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5140 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5141 if(store) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5142 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5143 /* These should be separate but right now this will work */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5144 if(flags & DW_CRA_SELECTED) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5145 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5146 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(cont)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5147 GList *list = gtk_tree_selection_get_selected_rows(sel, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5148 if(list) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5149 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5150 GtkTreePath *path = g_list_nth_data(list, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5151 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5152 if(path) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5153 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5154 gint *indices = gtk_tree_path_get_indices(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5155 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5156 if(indices) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5157 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5158 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5159 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5160 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, indices[0])) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5161 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5162 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, type, &retval, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5163 g_object_set_data(G_OBJECT(cont), "_dw_querypos", GINT_TO_POINTER(1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5164 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5165 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5166 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5167 g_list_foreach(list, (GFunc) gtk_tree_path_free, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5168 g_list_free(list); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5169 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5170 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5171 else if(flags & DW_CRA_CURSORED) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5172 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5173 GtkTreePath *path; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5174 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5175 gtk_tree_view_get_cursor(GTK_TREE_VIEW(cont), &path, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5176 if(path) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5177 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5178 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5179 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5180 if(gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5181 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5182 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, type, &retval, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5183 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5184 gtk_tree_path_free(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5185 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5186 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5187 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5188 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5189 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5190 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5191 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, 0)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5192 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5193 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, type, &retval, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5194 g_object_set_data(G_OBJECT(cont), "_dw_querypos", GINT_TO_POINTER(1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5195 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5196 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5197 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5198 /* If there is a title, duplicate it and free the temporary copy */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5199 if(retval && type == _DW_DATA_TYPE_STRING) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5200 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5201 char *temp = retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5202 retval = strdup(temp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5203 g_free(temp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5204 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5205 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5206 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5207 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5208 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5209 * Continues an existing query of a container. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5210 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5211 * handle: Handle to the window (widget) to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5212 * flags: If this parameter is DW_CRA_SELECTED it will only |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5213 * return items that are currently selected. Otherwise |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5214 * it will return all records in the container. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5215 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5216 char *dw_container_query_next(HWND handle, unsigned long flags) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5217 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5218 GtkWidget *cont; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5219 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5220 char *retval = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5221 int type = flags & DW_CR_RETDATA ? _DW_DATA_TYPE_POINTER : _DW_DATA_TYPE_STRING; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5222 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5223 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5224 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5225 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5226 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5227 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5228 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5229 if(store) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5230 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5231 int pos = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), "_dw_querypos")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5232 int count = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5233 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5234 /* These should be separate but right now this will work */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5235 if(flags & DW_CRA_SELECTED) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5236 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5237 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(cont)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5238 GList *list = gtk_tree_selection_get_selected_rows(sel, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5239 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5240 if(list) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5241 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5242 GtkTreePath *path = g_list_nth_data(list, pos); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5243 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5244 if(path) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5245 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5246 gint *indices = gtk_tree_path_get_indices(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5247 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5248 if(indices) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5249 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5250 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5251 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5252 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, indices[0])) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5253 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5254 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, type, &retval, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5255 g_object_set_data(G_OBJECT(cont), "_dw_querypos", GINT_TO_POINTER(pos+1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5256 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5257 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5258 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5259 g_list_foreach(list, (GFunc) gtk_tree_path_free, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5260 g_list_free(list); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5261 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5262 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5263 else if(flags & DW_CRA_CURSORED) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5264 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5265 /* There will only be one item cursored, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5266 * retrieve it with dw_container_query_start() |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5267 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5268 retval = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5269 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5270 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5271 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5272 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5273 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5274 if(pos < count && gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, pos)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5275 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5276 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, type, &retval, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5277 g_object_set_data(G_OBJECT(cont), "_dw_querypos", GINT_TO_POINTER(pos+1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5278 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5279 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5280 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5281 /* If there is a title, duplicate it and free the temporary copy */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5282 if(retval && type == _DW_DATA_TYPE_STRING) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5283 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5284 char *temp = retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5285 retval = strdup(temp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5286 g_free(temp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5287 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5288 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5289 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5290 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5291 int _find_iter(GtkListStore *store, GtkTreeIter *iter, void *data, int textcomp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5292 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5293 int z, rows = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5294 void *thisdata; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5295 int retval = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5296 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5297 for(z=0;z<rows;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5298 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5299 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), iter, NULL, z)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5300 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5301 /* Get either string from position 0 or pointer from position 1 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5302 gtk_tree_model_get(GTK_TREE_MODEL(store), iter, textcomp ? _DW_DATA_TYPE_STRING : _DW_DATA_TYPE_POINTER, &thisdata, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5303 if((textcomp && thisdata && strcmp((char *)thisdata, (char *)data) == 0) || (!textcomp && thisdata == data)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5304 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5305 retval = TRUE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5306 z = rows; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5307 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5308 if(textcomp && thisdata) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5309 g_free(thisdata); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5310 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5311 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5312 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5313 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5314 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5315 void _dw_container_cursor(HWND handle, void *data, int textcomp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5316 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5317 GtkWidget *cont; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5318 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5319 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5320 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5321 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5322 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5323 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5324 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5325 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5326 if(store) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5327 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5328 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5329 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5330 if(_find_iter(store, &iter, data, textcomp)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5331 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5332 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5333 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5334 if(path) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5335 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5336 gtk_tree_view_row_activated(GTK_TREE_VIEW(cont), path, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5337 gtk_tree_path_free(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5338 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5339 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5340 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5341 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5342 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5343 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5344 * Cursors the item with the text speficied, and scrolls to that item. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5345 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5346 * handle: Handle to the window (widget) to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5347 * text: Text usually returned by dw_container_query(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5348 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5349 void dw_container_cursor(HWND handle, const char *text) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5350 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5351 _dw_container_cursor(handle, (void *)text, TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5352 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5353 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5354 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5355 * Cursors the item with the text speficied, and scrolls to that item. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5356 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5357 * handle: Handle to the window (widget) to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5358 * text: Text usually returned by dw_container_query(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5359 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5360 void dw_container_cursor_by_data(HWND handle, void *data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5361 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5362 _dw_container_cursor(handle, data, FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5363 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5364 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5365 void _dw_container_delete_row(HWND handle, void *data, int textcomp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5366 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5367 GtkWidget *cont; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5368 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5369 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5370 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5371 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5372 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5373 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5374 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5375 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5376 if(store) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5377 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5378 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5379 int rows = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), "_dw_rowcount")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5380 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5381 if(_find_iter(store, &iter, data, textcomp)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5382 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5383 gtk_list_store_remove(store, &iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5384 rows--; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5385 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5386 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5387 g_object_set_data(G_OBJECT(cont), "_dw_rowcount", GINT_TO_POINTER(rows)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5388 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5389 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5390 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5391 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5392 * Deletes the item with the text speficied. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5393 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5394 * handle: Handle to the window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5395 * text: Text usually returned by dw_container_query(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5396 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5397 void dw_container_delete_row(HWND handle, const char *text) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5398 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5399 _dw_container_delete_row(handle, (void *)text, TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5400 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5401 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5402 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5403 * Deletes the item with the text speficied. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5404 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5405 * handle: Handle to the window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5406 * text: Text usually returned by dw_container_query(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5407 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5408 void dw_container_delete_row_by_data(HWND handle, void *data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5409 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5410 _dw_container_delete_row(handle, data, FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5411 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5412 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5413 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5414 * Optimizes the column widths so that all data is visible. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5415 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5416 * handle: Handle to the window (widget) to be optimized. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5417 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5418 void dw_container_optimize(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5419 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5420 GtkWidget *cont; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5421 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5422 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5423 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5424 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5425 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5426 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(cont)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5427 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5428 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5429 /* Translate the status message into a message on our buddy window */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5430 static void _status_translate(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5431 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5432 GdkEventButton event = { 0 }; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5433 long x, y; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5434 gboolean retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5435 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5436 dw_pointer_query_pos(&x, &y); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5437 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5438 event.button = button; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5439 event.x = x; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5440 event.y = y; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5441 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5442 g_signal_emit_by_name(G_OBJECT(user_data), "button_press_event", &event, &retval); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5443 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5444 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5445 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5446 * Inserts an icon into the taskbar. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5447 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5448 * handle: Window handle that will handle taskbar icon messages. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5449 * icon: Icon handle to display in the taskbar. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5450 * bubbletext: Text to show when the mouse is above the icon. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5451 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5452 void dw_taskbar_insert(HWND handle, HICN icon, const char *bubbletext) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5453 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5454 GtkStatusIcon *status; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5455 GdkPixbuf *pixbuf; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5456 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5457 pixbuf = _find_pixbuf(icon, NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5458 status = gtk_status_icon_new_from_pixbuf(pixbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5459 if(bubbletext) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5460 gtk_status_icon_set_tooltip_text(status, bubbletext); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5461 g_object_set_data(G_OBJECT(handle), "_dw_taskbar", status); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5462 g_signal_connect(G_OBJECT (status), "popup-menu", G_CALLBACK (_status_translate), handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5463 gtk_status_icon_set_visible(status, TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5464 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5465 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5466 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5467 * Deletes an icon from the taskbar. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5468 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5469 * handle: Window handle that was used with dw_taskbar_insert(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5470 * icon: Icon handle that was used with dw_taskbar_insert(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5471 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5472 void dw_taskbar_delete(HWND handle, HICN icon) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5473 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5474 GtkStatusIcon *status; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5475 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5476 status = g_object_get_data(G_OBJECT(handle), "_dw_taskbar"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5477 g_object_unref(G_OBJECT(status)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5478 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5479 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5480 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5481 * Creates a rendering context widget (window) to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5482 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5483 * id: An id to be used with dw_window_from_id. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5484 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5485 * A handle to the widget or NULL on failure. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5486 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5487 HWND dw_render_new(unsigned long id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5488 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5489 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5490 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5491 tmp = gtk_drawing_area_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5492 gtk_widget_set_events(tmp, GDK_EXPOSURE_MASK |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5493 | GDK_LEAVE_NOTIFY_MASK |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5494 | GDK_BUTTON_PRESS_MASK |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5495 | GDK_BUTTON_RELEASE_MASK |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5496 | GDK_KEY_PRESS_MASK |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5497 | GDK_POINTER_MOTION_MASK |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5498 | GDK_POINTER_MOTION_HINT_MASK); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5499 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5500 gtk_widget_set_can_focus(tmp, TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5501 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5502 if(_DWDefaultFont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5503 dw_window_set_font(tmp, _DWDefaultFont); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5504 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5505 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5506 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5507 /* Returns a GdkRGBA from a DW color */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5508 static GdkRGBA _internal_color(unsigned long value) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5509 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5510 if(DW_RGB_COLOR & value) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5511 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5512 GdkRGBA color = { (gfloat)DW_RED_VALUE(value) / 255.0, (gfloat)DW_GREEN_VALUE(value) / 255.0, (gfloat)DW_BLUE_VALUE(value) / 255.0, 1.0 }; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5513 return color; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5514 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5515 if (value < 16) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5516 return _colors[value]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5517 return _colors[0]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5518 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5519 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5520 /* Sets the current foreground drawing color. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5521 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5522 * red: red value. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5523 * green: green value. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5524 * blue: blue value. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5525 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5526 void dw_color_foreground_set(unsigned long value) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5527 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5528 GdkRGBA color = _internal_color(value); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5529 GdkRGBA *foreground = pthread_getspecific(_dw_fg_color_key); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5530 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5531 *foreground = color; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5532 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5533 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5534 /* Sets the current background drawing color. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5535 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5536 * red: red value. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5537 * green: green value. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5538 * blue: blue value. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5539 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5540 void dw_color_background_set(unsigned long value) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5541 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5542 GdkRGBA *background = pthread_getspecific(_dw_bg_color_key); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5543 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5544 if(value == DW_CLR_DEFAULT) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5545 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5546 if(background) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5547 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5548 pthread_setspecific(_dw_bg_color_key, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5549 free(background); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5550 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5551 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5552 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5553 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5554 GdkRGBA color = _internal_color(value); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5555 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5556 if(!background) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5557 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5558 background = malloc(sizeof(GdkRGBA)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5559 pthread_setspecific(_dw_bg_color_key, background); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5560 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5561 *background = color; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5562 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5563 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5564 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5565 /* Allows the user to choose a color using the system's color chooser dialog. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5566 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5567 * value: current color |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5568 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5569 * The selected color or the current color if cancelled. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5570 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5571 unsigned long API dw_color_choose(unsigned long value) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5572 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5573 GtkColorChooser *cd; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5574 GdkRGBA color = _internal_color(value); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5575 unsigned long retcolor = value; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5576 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5577 cd = (GtkColorChooser *)gtk_color_chooser_dialog_new("Choose color", NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5578 gtk_color_chooser_set_use_alpha(cd, FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5579 gtk_color_chooser_set_rgba(cd, &color); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5580 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5581 gtk_widget_show(GTK_WIDGET(cd)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5582 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5583 if(gtk_dialog_run(GTK_DIALOG(cd)) == GTK_RESPONSE_OK) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5584 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5585 gtk_color_chooser_get_rgba(cd, &color); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5586 retcolor = DW_RGB((int)(color.red * 255), (int)(color.green * 255), (int)(color.blue * 255)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5587 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5588 gtk_widget_destroy(GTK_WIDGET(cd)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5589 return retcolor; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5590 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5591 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5592 /* Draw a point on a window (preferably a render window). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5593 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5594 * handle: Handle to the window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5595 * pixmap: Handle to the pixmap. (choose only one of these) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5596 * x: X coordinate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5597 * y: Y coordinate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5598 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5599 void dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5600 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5601 cairo_t *cr = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5602 GdkDrawingContext *dc = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5603 cairo_region_t *clip = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5604 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5605 if(handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5606 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5607 GdkWindow *window = gtk_widget_get_window(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5608 /* Safety check for non-existant windows */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5609 if(!window || !GDK_IS_WINDOW(window)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5610 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5611 clip = gdk_window_get_clip_region(window); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5612 dc = gdk_window_begin_draw_frame(window, clip); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5613 cr = gdk_drawing_context_get_cairo_context(dc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5614 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5615 else if(pixmap) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5616 cr = cairo_create(pixmap->image); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5617 if(cr) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5618 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5619 GdkRGBA *foreground = pthread_getspecific(_dw_fg_color_key); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5620 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5621 gdk_cairo_set_source_rgba(cr, foreground); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5622 cairo_set_line_width(cr, 1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5623 cairo_move_to(cr, x, y); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5624 cairo_stroke(cr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5625 if(clip) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5626 cairo_region_destroy(clip); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5627 /* If we are using a drawing context... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5628 * we don't own the cairo context so don't destroy it. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5629 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5630 if(dc) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5631 gdk_window_end_draw_frame(gtk_widget_get_window(handle), dc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5632 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5633 cairo_destroy(cr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5634 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5635 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5636 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5637 /* Draw a line on a window (preferably a render window). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5638 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5639 * handle: Handle to the window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5640 * pixmap: Handle to the pixmap. (choose only one of these) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5641 * x1: First X coordinate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5642 * y1: First Y coordinate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5643 * x2: Second X coordinate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5644 * y2: Second Y coordinate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5645 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5646 void dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5647 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5648 cairo_t *cr = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5649 GdkDrawingContext *dc = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5650 cairo_region_t *clip = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5651 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5652 if(handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5653 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5654 GdkWindow *window = gtk_widget_get_window(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5655 /* Safety check for non-existant windows */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5656 if(!window || !GDK_IS_WINDOW(window)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5657 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5658 clip = gdk_window_get_clip_region(window); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5659 dc = gdk_window_begin_draw_frame(window, clip); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5660 cr = gdk_drawing_context_get_cairo_context(dc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5661 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5662 else if(pixmap) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5663 cr = cairo_create(pixmap->image); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5664 if(cr) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5665 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5666 GdkRGBA *foreground = pthread_getspecific(_dw_fg_color_key); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5667 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5668 gdk_cairo_set_source_rgba(cr, foreground); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5669 cairo_set_line_width(cr, 1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5670 cairo_move_to(cr, x1, y1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5671 cairo_line_to(cr, x2, y2); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5672 cairo_stroke(cr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5673 if(clip) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5674 cairo_region_destroy(clip); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5675 /* If we are using a drawing context... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5676 * we don't own the cairo context so don't destroy it. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5677 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5678 if(dc) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5679 gdk_window_end_draw_frame(gtk_widget_get_window(handle), dc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5680 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5681 cairo_destroy(cr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5682 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5683 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5684 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5685 /* Draw a closed polygon on a window (preferably a render window). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5686 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5687 * handle: Handle to the window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5688 * pixmap: Handle to the pixmap. (choose only one of these) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5689 * flags: DW_DRAW_FILL (1) to fill the polygon or DW_DRAW_DEFAULT (0). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5690 * number of points |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5691 * x[]: X coordinates. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5692 * y[]: Y coordinates. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5693 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5694 void dw_draw_polygon(HWND handle, HPIXMAP pixmap, int flags, int npoints, int *x, int *y) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5695 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5696 cairo_t *cr = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5697 int z; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5698 GdkDrawingContext *dc = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5699 cairo_region_t *clip = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5700 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5701 if(handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5702 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5703 GdkWindow *window = gtk_widget_get_window(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5704 /* Safety check for non-existant windows */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5705 if(!window || !GDK_IS_WINDOW(window)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5706 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5707 clip = gdk_window_get_clip_region(window); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5708 dc = gdk_window_begin_draw_frame(window, clip); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5709 cr = gdk_drawing_context_get_cairo_context(dc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5710 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5711 else if(pixmap) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5712 cr = cairo_create(pixmap->image); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5713 if(cr) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5714 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5715 GdkRGBA *foreground = pthread_getspecific(_dw_fg_color_key); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5716 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5717 if(flags & DW_DRAW_NOAA) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5718 cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5719 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5720 gdk_cairo_set_source_rgba(cr, foreground); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5721 cairo_set_line_width(cr, 1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5722 cairo_move_to(cr, x[0], y[0]); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5723 for(z=1;z<npoints;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5724 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5725 cairo_line_to(cr, x[z], y[z]); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5726 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5727 if(flags & DW_DRAW_FILL) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5728 cairo_fill(cr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5729 cairo_stroke(cr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5730 if(clip) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5731 cairo_region_destroy(clip); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5732 /* If we are using a drawing context... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5733 * we don't own the cairo context so don't destroy it. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5734 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5735 if(dc) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5736 gdk_window_end_draw_frame(gtk_widget_get_window(handle), dc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5737 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5738 cairo_destroy(cr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5739 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5740 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5741 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5742 /* Draw a rectangle on a window (preferably a render window). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5743 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5744 * handle: Handle to the window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5745 * pixmap: Handle to the pixmap. (choose only one of these) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5746 * flags: DW_DRAW_FILL (1) to fill the box or DW_DRAW_DEFAULT (0). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5747 * x: X coordinate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5748 * y: Y coordinate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5749 * width: Width of rectangle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5750 * height: Height of rectangle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5751 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5752 void dw_draw_rect(HWND handle, HPIXMAP pixmap, int flags, int x, int y, int width, int height) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5753 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5754 cairo_t *cr = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5755 GdkDrawingContext *dc = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5756 cairo_region_t *clip = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5757 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5758 if(handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5759 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5760 GdkWindow *window = gtk_widget_get_window(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5761 /* Safety check for non-existant windows */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5762 if(!window || !GDK_IS_WINDOW(window)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5763 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5764 clip = gdk_window_get_clip_region(window); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5765 dc = gdk_window_begin_draw_frame(window, clip); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5766 cr = gdk_drawing_context_get_cairo_context(dc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5767 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5768 else if(pixmap) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5769 cr = cairo_create(pixmap->image); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5770 if(cr) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5771 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5772 GdkRGBA *foreground = pthread_getspecific(_dw_fg_color_key); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5773 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5774 if(flags & DW_DRAW_NOAA) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5775 cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5776 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5777 gdk_cairo_set_source_rgba(cr, foreground); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5778 cairo_set_line_width(cr, 1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5779 cairo_move_to(cr, x, y); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5780 cairo_line_to(cr, x, y + height); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5781 cairo_line_to(cr, x + width, y + height); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5782 cairo_line_to(cr, x + width, y); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5783 if(flags & DW_DRAW_FILL) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5784 cairo_fill(cr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5785 cairo_stroke(cr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5786 if(clip) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5787 cairo_region_destroy(clip); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5788 /* If we are using a drawing context... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5789 * we don't own the cairo context so don't destroy it. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5790 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5791 if(dc) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5792 gdk_window_end_draw_frame(gtk_widget_get_window(handle), dc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5793 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5794 cairo_destroy(cr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5795 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5796 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5797 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5798 /* Draw an arc on a window (preferably a render window). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5799 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5800 * handle: Handle to the window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5801 * pixmap: Handle to the pixmap. (choose only one of these) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5802 * flags: DW_DRAW_FILL (1) to fill the arc or DW_DRAW_DEFAULT (0). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5803 * DW_DRAW_FULL will draw a complete circle/elipse. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5804 * xorigin: X coordinate of center of arc. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5805 * yorigin: Y coordinate of center of arc. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5806 * x1: X coordinate of first segment of arc. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5807 * y1: Y coordinate of first segment of arc. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5808 * x2: X coordinate of second segment of arc. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5809 * y2: Y coordinate of second segment of arc. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5810 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5811 void API dw_draw_arc(HWND handle, HPIXMAP pixmap, int flags, int xorigin, int yorigin, int x1, int y1, int x2, int y2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5812 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5813 cairo_t *cr = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5814 GdkDrawingContext *dc = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5815 cairo_region_t *clip = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5816 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5817 if(handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5818 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5819 GdkWindow *window = gtk_widget_get_window(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5820 /* Safety check for non-existant windows */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5821 if(!window || !GDK_IS_WINDOW(window)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5822 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5823 clip = gdk_window_get_clip_region(window); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5824 dc = gdk_window_begin_draw_frame(window, clip); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5825 cr = gdk_drawing_context_get_cairo_context(dc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5826 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5827 else if(pixmap) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5828 cr = cairo_create(pixmap->image); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5829 if(cr) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5830 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5831 GdkRGBA *foreground = pthread_getspecific(_dw_fg_color_key); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5832 int width = abs(x2-x1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5833 float scale = fabs((float)(y2-y1))/(float)width; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5834 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5835 if(flags & DW_DRAW_NOAA) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5836 cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5837 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5838 gdk_cairo_set_source_rgba(cr, foreground); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5839 cairo_set_line_width(cr, 1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5840 if(scale != 1.0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5841 cairo_scale(cr, 1.0, scale); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5842 if(flags & DW_DRAW_FULL) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5843 cairo_arc(cr, xorigin, yorigin / scale, width/2, 0, M_PI*2); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5844 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5845 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5846 double dx = xorigin - x1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5847 double dy = yorigin - y1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5848 double r = sqrt(dx*dx + dy*dy); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5849 double a1 = atan2((y1-yorigin), (x1-xorigin)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5850 double a2 = atan2((y2-yorigin), (x2-xorigin)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5851 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5852 cairo_arc(cr, xorigin, yorigin, r, a1, a2); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5853 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5854 if(flags & DW_DRAW_FILL) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5855 cairo_fill(cr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5856 cairo_stroke(cr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5857 if(clip) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5858 cairo_region_destroy(clip); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5859 /* If we are using a drawing context... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5860 * we don't own the cairo context so don't destroy it. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5861 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5862 if(dc) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5863 gdk_window_end_draw_frame(gtk_widget_get_window(handle), dc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5864 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5865 cairo_destroy(cr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5866 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5867 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5868 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5869 /* Draw text on a window (preferably a render window). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5870 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5871 * handle: Handle to the window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5872 * pixmap: Handle to the pixmap. (choose only one of these) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5873 * x: X coordinate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5874 * y: Y coordinate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5875 * text: Text to be displayed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5876 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5877 void dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, const char *text) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5878 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5879 cairo_t *cr = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5880 PangoFontDescription *font; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5881 char *tmpname, *fontname = "monospace 10"; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5882 GdkDrawingContext *dc = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5883 cairo_region_t *clip = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5884 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5885 if(!text) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5886 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5887 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5888 if(handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5889 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5890 GdkWindow *window = gtk_widget_get_window(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5891 /* Safety check for non-existant windows */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5892 if(!window || !GDK_IS_WINDOW(window)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5893 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5894 clip = gdk_window_get_clip_region(window); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5895 dc = gdk_window_begin_draw_frame(window, clip); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5896 cr = gdk_drawing_context_get_cairo_context(dc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5897 if((tmpname = (char *)g_object_get_data(G_OBJECT(handle), "_dw_fontname"))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5898 fontname = tmpname; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5899 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5900 else if(pixmap) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5901 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5902 if(pixmap->font) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5903 fontname = pixmap->font; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5904 else if(pixmap->handle && (tmpname = (char *)g_object_get_data(G_OBJECT(pixmap->handle), "_dw_fontname"))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5905 fontname = tmpname; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5906 cr = cairo_create(pixmap->image); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5907 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5908 if(cr) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5909 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5910 font = pango_font_description_from_string(fontname); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5911 if(font) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5912 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5913 PangoContext *context = pango_cairo_create_context(cr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5914 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5915 if(context) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5916 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5917 PangoLayout *layout = pango_layout_new(context); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5918 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5919 if(layout) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5920 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5921 GdkRGBA *foreground = pthread_getspecific(_dw_fg_color_key); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5922 GdkRGBA *background = pthread_getspecific(_dw_bg_color_key); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5923 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5924 pango_layout_set_font_description(layout, font); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5925 pango_layout_set_text(layout, text, strlen(text)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5926 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5927 gdk_cairo_set_source_rgba(cr, foreground); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5928 /* Create a background color attribute if required */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5929 if(background) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5930 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5931 PangoAttrList *list = pango_layout_get_attributes(layout); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5932 PangoAttribute *attr = pango_attr_background_new((guint16)(background->red * 65535), |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5933 (guint16)(background->green * 65535), |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5934 (guint16)(background->blue* 65535)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5935 if(!list) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5936 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5937 list = pango_attr_list_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5938 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5939 pango_attr_list_change(list, attr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5940 pango_layout_set_attributes(layout, list); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5941 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5942 /* Do the drawing */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5943 cairo_move_to(cr, x, y); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5944 pango_cairo_show_layout (cr, layout); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5945 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5946 g_object_unref(layout); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5947 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5948 g_object_unref(context); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5949 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5950 pango_font_description_free(font); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5951 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5952 if(clip) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5953 cairo_region_destroy(clip); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5954 /* If we are using a drawing context... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5955 * we don't own the cairo context so don't destroy it. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5956 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5957 if(dc) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5958 gdk_window_end_draw_frame(gtk_widget_get_window(handle), dc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5959 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5960 cairo_destroy(cr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5961 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5962 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5963 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5964 /* Query the width and height of a text string. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5965 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5966 * handle: Handle to the window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5967 * pixmap: Handle to the pixmap. (choose only one of these) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5968 * text: Text to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5969 * width: Pointer to a variable to be filled in with the width. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5970 * height Pointer to a variable to be filled in with the height. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5971 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5972 void dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, const char *text, int *width, int *height) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5973 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5974 PangoFontDescription *font; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5975 char *fontname = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5976 int free_fontname = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5977 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5978 if(!text) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5979 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5980 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5981 if(handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5982 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5983 fontname = (char *)g_object_get_data(G_OBJECT(handle), "_dw_fontname"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5984 if ( fontname == NULL ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5985 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5986 fontname = dw_window_get_font(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5987 free_fontname = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5988 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5989 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5990 else if(pixmap) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5991 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5992 if(pixmap->font) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5993 fontname = pixmap->font; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5994 else if(pixmap->handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5995 fontname = (char *)g_object_get_data(G_OBJECT(pixmap->handle), "_dw_fontname"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5996 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5997 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5998 font = pango_font_description_from_string(fontname ? fontname : "monospace 10"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5999 if(font) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6000 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6001 PangoContext *context = gdk_pango_context_get(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6002 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6003 if(context) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6004 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6005 PangoLayout *layout = pango_layout_new(context); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6006 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6007 if(layout) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6008 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6009 PangoRectangle rect; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6010 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6011 pango_layout_set_font_description(layout, font); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6012 pango_layout_set_text(layout, text, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6013 pango_layout_get_pixel_extents(layout, NULL, &rect); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6014 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6015 if(width) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6016 *width = rect.width; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6017 if(height) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6018 *height = rect.height; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6019 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6020 g_object_unref(layout); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6021 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6022 g_object_unref(context); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6023 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6024 pango_font_description_free(font); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6025 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6026 if ( free_fontname ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6027 free( fontname ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6028 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6029 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6030 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6031 * Creates a pixmap with given parameters. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6032 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6033 * handle: Window handle the pixmap is associated with. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6034 * or zero to enable this pixmap to be written |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6035 * off the screen to reduce flicker |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6036 * width: Width of the pixmap in pixels. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6037 * height: Height of the pixmap in pixels. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6038 * depth: Color depth of the pixmap. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6039 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6040 * A handle to a pixmap or NULL on failure. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6041 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6042 HPIXMAP dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6043 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6044 HPIXMAP pixmap; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6045 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6046 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6047 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6048 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6049 if (!depth) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6050 depth = -1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6051 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6052 pixmap->width = width; pixmap->height = height; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6053 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6054 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6055 pixmap->handle = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6056 /* Depth needs to be divided by 3... but for the RGB colorspace... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6057 * only 8 bits per sample is allowed, so to avoid issues just pass 8 for now. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6058 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6059 pixmap->pixbuf = gdk_pixbuf_new( GDK_COLORSPACE_RGB, FALSE, 8, width, height ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6060 pixmap->image = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6061 return pixmap; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6062 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6063 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6064 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6065 * Creates a pixmap from a file. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6066 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6067 * handle: Window handle the pixmap is associated with. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6068 * filename: Name of the file, omit extention to have |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6069 * DW pick the appropriate file extension. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6070 * (BMP on OS/2 or Windows, XPM on Unix) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6071 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6072 * A handle to a pixmap or NULL on failure. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6073 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6074 HPIXMAP dw_pixmap_new_from_file(HWND handle, const char *filename) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6075 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6076 HPIXMAP pixmap; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6077 char *file = alloca(strlen(filename) + 6); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6078 int found_ext = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6079 int i; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6080 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6081 if (!file || !(pixmap = calloc(1,sizeof(struct _hpixmap)))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6082 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6083 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6084 strcpy(file, filename); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6085 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6086 /* check if we can read from this file (it exists and read permission) */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6087 if(access(file, 04) != 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6088 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6089 /* Try with various extentions */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6090 for ( i = 0; i < NUM_EXTS; i++ ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6091 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6092 strcpy( file, filename ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6093 strcat( file, image_exts[i] ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6094 if ( access( file, 04 ) == 0 ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6095 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6096 found_ext = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6097 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6098 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6099 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6100 if ( found_ext == 0 ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6101 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6102 free(pixmap); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6103 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6104 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6105 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6106 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6107 pixmap->pixbuf = gdk_pixbuf_new_from_file(file, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6108 pixmap->image = cairo_image_surface_create_from_png(file); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6109 pixmap->width = gdk_pixbuf_get_width(pixmap->pixbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6110 pixmap->height = gdk_pixbuf_get_height(pixmap->pixbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6111 pixmap->handle = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6112 return pixmap; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6113 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6114 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6115 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6116 * Creates a pixmap from data |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6117 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6118 * handle: Window handle the pixmap is associated with. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6119 * data: Source of image data |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6120 * DW pick the appropriate file extension. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6121 * (BMP on OS/2 or Windows, XPM on Unix) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6122 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6123 * A handle to a pixmap or NULL on failure. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6124 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6125 HPIXMAP dw_pixmap_new_from_data(HWND handle, const char *data, int len) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6126 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6127 int fd, written = -1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6128 HPIXMAP pixmap; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6129 char template[] = "/tmp/dwpixmapXXXXXX"; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6130 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6131 if(!data || !(pixmap = calloc(1,sizeof(struct _hpixmap)))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6132 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6133 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6134 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6135 * A real hack; create a temporary file and write the contents |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6136 * of the data to the file |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6137 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6138 if((fd = mkstemp(template)) != -1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6139 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6140 written = write(fd, data, len); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6141 close(fd); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6142 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6143 /* Bail if we couldn't write full file */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6144 if(fd == -1 || written != len) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6145 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6146 pixmap->pixbuf = gdk_pixbuf_new_from_file(template, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6147 pixmap->image = cairo_image_surface_create_from_png(template); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6148 pixmap->width = gdk_pixbuf_get_width(pixmap->pixbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6149 pixmap->height = gdk_pixbuf_get_height(pixmap->pixbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6150 /* remove our temporary file */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6151 unlink(template); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6152 pixmap->handle = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6153 return pixmap; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6154 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6155 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6156 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6157 * Sets the transparent color for a pixmap |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6158 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6159 * pixmap: Handle to a pixmap returned by |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6160 * dw_pixmap_new.. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6161 * color: transparent color |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6162 * Note: This does nothing on GTK+ as transparency |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6163 * is handled automatically |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6164 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6165 void dw_pixmap_set_transparent_color(HPIXMAP pixmap, unsigned long color) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6166 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6167 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6168 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6169 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6170 * Creates a pixmap from internal resource graphic specified by id. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6171 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6172 * handle: Window handle the pixmap is associated with. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6173 * id: Resource ID associated with requested pixmap. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6174 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6175 * A handle to a pixmap or NULL on failure. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6176 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6177 HPIXMAP dw_pixmap_grab(HWND handle, ULONG id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6178 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6179 HPIXMAP pixmap; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6180 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6181 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6182 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6183 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6184 pixmap->pixbuf = gdk_pixbuf_copy(_find_pixbuf((HICN)id, &pixmap->width, &pixmap->height)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6185 return pixmap; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6186 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6187 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6188 /* Call this after drawing to the screen to make sure |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6189 * anything you have drawn is visible. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6190 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6191 void dw_flush(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6192 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6193 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6194 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6195 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6196 * Sets the font used by a specified pixmap. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6197 * Normally the pixmap font is obtained from the associated window handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6198 * However this can be used to override that, or for pixmaps with no window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6199 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6200 * pixmap: Handle to a pixmap returned by dw_pixmap_new() or |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6201 * passed to the application via a callback. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6202 * fontname: Name and size of the font in the form "size.fontname" |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6203 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6204 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6205 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6206 int API dw_pixmap_set_font(HPIXMAP pixmap, const char *fontname) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6207 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6208 if(pixmap) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6209 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6210 char *oldfont = pixmap->font; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6211 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6212 pixmap->font = _convert_font(fontname); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6213 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6214 if(oldfont) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6215 free(oldfont); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6216 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6217 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6218 return DW_ERROR_GENERAL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6219 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6220 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6221 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6222 * Destroys an allocated pixmap. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6223 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6224 * pixmap: Handle to a pixmap returned by |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6225 * dw_pixmap_new.. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6226 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6227 void dw_pixmap_destroy(HPIXMAP pixmap) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6228 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6229 g_object_unref(G_OBJECT(pixmap->pixbuf)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6230 cairo_surface_destroy(pixmap->image); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6231 if(pixmap->font) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6232 free(pixmap->font); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6233 free(pixmap); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6234 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6235 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6236 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6237 * Copies from one item to another. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6238 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6239 * dest: Destination window handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6240 * destp: Destination pixmap. (choose only one). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6241 * xdest: X coordinate of destination. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6242 * ydest: Y coordinate of destination. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6243 * width: Width of area to copy. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6244 * height: Height of area to copy. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6245 * src: Source window handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6246 * srcp: Source pixmap. (choose only one). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6247 * xsrc: X coordinate of source. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6248 * ysrc: Y coordinate of source. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6249 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6250 void API dw_pixmap_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6251 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6252 dw_pixmap_stretch_bitblt(dest, destp, xdest, ydest, width, height, src, srcp, xsrc, ysrc, -1, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6253 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6254 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6255 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6256 * Copies from one surface to another allowing for stretching. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6257 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6258 * dest: Destination window handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6259 * destp: Destination pixmap. (choose only one). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6260 * xdest: X coordinate of destination. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6261 * ydest: Y coordinate of destination. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6262 * width: Width of the target area. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6263 * height: Height of the target area. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6264 * src: Source window handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6265 * srcp: Source pixmap. (choose only one). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6266 * xsrc: X coordinate of source. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6267 * ysrc: Y coordinate of source. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6268 * srcwidth: Width of area to copy. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6269 * srcheight: Height of area to copy. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6270 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6271 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6272 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6273 int API dw_pixmap_stretch_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc, int srcwidth, int srcheight) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6274 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6275 cairo_t *cr = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6276 int retval = DW_ERROR_GENERAL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6277 GdkDrawingContext *dc = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6278 cairo_region_t *clip = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6279 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6280 if((!dest && (!destp || !destp->image)) || (!src && (!srcp || !srcp->image))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6281 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6282 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6283 if(dest) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6284 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6285 GdkWindow *window = gtk_widget_get_window(dest); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6286 /* Safety check for non-existant windows */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6287 if(!window || !GDK_IS_WINDOW(window)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6288 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6289 clip = gdk_window_get_clip_region(window); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6290 dc = gdk_window_begin_draw_frame(window, clip); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6291 cr = gdk_drawing_context_get_cairo_context(dc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6292 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6293 else if(destp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6294 cr = cairo_create(destp->image); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6295 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6296 if(cr) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6297 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6298 double xscale = 1, yscale = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6299 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6300 if(srcwidth != -1 && srcheight != -1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6301 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6302 xscale = (double)width / (double)srcwidth; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6303 yscale = (double)height / (double)srcheight; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6304 cairo_scale(cr, xscale, yscale); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6305 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6306 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6307 if(src) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6308 gdk_cairo_set_source_window (cr, gtk_widget_get_window(src), (xdest + xsrc) / xscale, (ydest + ysrc) / yscale); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6309 else if(srcp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6310 cairo_set_source_surface (cr, srcp->image, (xdest + xsrc) / xscale, (ydest + ysrc) / yscale); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6311 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6312 cairo_rectangle(cr, xdest / xscale, ydest / yscale, width, height); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6313 cairo_fill(cr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6314 if(clip) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6315 cairo_region_destroy(clip); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6316 /* If we are using a drawing context... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6317 * we don't own the cairo context so don't destroy it. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6318 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6319 if(dc) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6320 gdk_window_end_draw_frame(gtk_widget_get_window(dest), dc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6321 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6322 cairo_destroy(cr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6323 retval = DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6324 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6325 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6326 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6327 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6328 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6329 * Emits a beep. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6330 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6331 * freq: Frequency. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6332 * dur: Duration. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6333 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6334 void dw_beep(int freq, int dur) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6335 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6336 gdk_display_beep(gdk_display_get_default()); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6337 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6338 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6339 void _my_strlwr(char *buf) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6340 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6341 int z, len = strlen(buf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6342 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6343 for(z=0;z<len;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6344 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6345 if(buf[z] >= 'A' && buf[z] <= 'Z') |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6346 buf[z] -= 'A' - 'a'; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6347 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6348 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6349 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6350 /* Open a shared library and return a handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6351 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6352 * name: Base name of the shared library. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6353 * handle: Pointer to a module handle, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6354 * will be filled in with the handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6355 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6356 int dw_module_load(const char *name, HMOD *handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6357 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6358 int len; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6359 char *newname; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6360 char errorbuf[1025] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6361 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6362 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6363 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6364 return -1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6365 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6366 if((len = strlen(name)) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6367 return -1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6368 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6369 /* Lenth + "lib" + ".so" + NULL */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6370 newname = malloc(len + 7); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6371 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6372 if(!newname) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6373 return -1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6374 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6375 sprintf(newname, "lib%s.so", name); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6376 _my_strlwr(newname); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6377 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6378 *handle = dlopen(newname, RTLD_NOW); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6379 if(*handle == NULL) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6380 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6381 strncpy(errorbuf, dlerror(), 1024); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6382 printf("%s\n", errorbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6383 sprintf(newname, "lib%s.so", name); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6384 *handle = dlopen(newname, RTLD_NOW); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6385 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6386 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6387 free(newname); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6388 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6389 return (NULL == *handle) ? -1 : 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6390 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6391 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6392 /* Queries the address of a symbol within open handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6393 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6394 * handle: Module handle returned by dw_module_load() |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6395 * name: Name of the symbol you want the address of. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6396 * func: A pointer to a function pointer, to obtain |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6397 * the address. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6398 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6399 int dw_module_symbol(HMOD handle, const char *name, void**func) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6400 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6401 if(!func || !name) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6402 return -1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6403 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6404 if(strlen(name) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6405 return -1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6406 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6407 *func = (void*)dlsym(handle, name); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6408 return (NULL == *func); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6409 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6410 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6411 /* Frees the shared library previously opened. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6412 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6413 * handle: Module handle returned by dw_module_load() |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6414 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6415 int dw_module_close(HMOD handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6416 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6417 if(handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6418 return dlclose(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6419 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6420 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6421 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6422 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6423 * Returns the handle to an unnamed mutex semaphore. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6424 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6425 HMTX dw_mutex_new(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6426 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6427 HMTX mutex = malloc(sizeof(pthread_mutex_t)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6428 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6429 pthread_mutex_init(mutex, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6430 return mutex; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6431 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6432 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6433 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6434 * Closes a semaphore created by dw_mutex_new(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6435 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6436 * mutex: The handle to the mutex returned by dw_mutex_new(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6437 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6438 void dw_mutex_close(HMTX mutex) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6439 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6440 if(mutex) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6441 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6442 pthread_mutex_destroy(mutex); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6443 free(mutex); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6444 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6445 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6446 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6447 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6448 * Tries to gain access to the semaphore, if it can't it blocks. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6449 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6450 * mutex: The handle to the mutex returned by dw_mutex_new(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6451 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6452 void dw_mutex_lock(HMTX mutex) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6453 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6454 /* If we are being called from an event handler we must release |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6455 * the GTK mutex so we don't deadlock. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6456 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6457 if(pthread_self() == _dw_thread) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6458 _dw_gdk_threads_leave(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6459 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6460 pthread_mutex_lock(mutex); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6461 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6462 /* And of course relock it when we have acquired the mutext */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6463 if(pthread_self() == _dw_thread) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6464 _dw_gdk_threads_enter(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6465 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6466 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6467 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6468 * Tries to gain access to the semaphore. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6469 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6470 * mutex: The handle to the mutex returned by dw_mutex_new(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6471 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6472 * DW_ERROR_NONE on success, DW_ERROR_TIMEOUT if it is already locked. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6473 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6474 int API dw_mutex_trylock(HMTX mutex) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6475 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6476 if(pthread_mutex_trylock(mutex) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6477 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6478 return DW_ERROR_TIMEOUT; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6479 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6480 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6481 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6482 * Reliquishes the access to the semaphore. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6483 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6484 * mutex: The handle to the mutex returned by dw_mutex_new(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6485 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6486 void dw_mutex_unlock(HMTX mutex) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6487 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6488 pthread_mutex_unlock(mutex); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6489 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6490 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6491 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6492 * Returns the handle to an unnamed event semaphore. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6493 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6494 HEV dw_event_new(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6495 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6496 HEV eve = (HEV)malloc(sizeof(struct _dw_unix_event)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6497 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6498 if(!eve) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6499 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6500 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6501 /* We need to be careful here, mutexes on Linux are |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6502 * FAST by default but are error checking on other |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6503 * systems such as FreeBSD and OS/2, perhaps others. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6504 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6505 pthread_mutex_init (&(eve->mutex), NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6506 pthread_mutex_lock (&(eve->mutex)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6507 pthread_cond_init (&(eve->event), NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6508 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6509 pthread_mutex_unlock (&(eve->mutex)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6510 eve->alive = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6511 eve->posted = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6512 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6513 return eve; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6514 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6515 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6516 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6517 * Resets a semaphore created by dw_event_new(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6518 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6519 * eve: The handle to the event returned by dw_event_new(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6520 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6521 int dw_event_reset (HEV eve) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6522 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6523 if(!eve) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6524 return DW_ERROR_NON_INIT; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6525 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6526 pthread_mutex_lock (&(eve->mutex)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6527 pthread_cond_broadcast (&(eve->event)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6528 pthread_cond_init (&(eve->event), NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6529 eve->posted = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6530 pthread_mutex_unlock (&(eve->mutex)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6531 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6532 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6533 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6534 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6535 * Posts a semaphore created by dw_event_new(). Causing all threads |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6536 * waiting on this event in dw_event_wait to continue. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6537 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6538 * eve: The handle to the event returned by dw_event_new(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6539 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6540 int dw_event_post (HEV eve) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6541 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6542 if(!eve) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6543 return DW_ERROR_NON_INIT; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6544 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6545 pthread_mutex_lock (&(eve->mutex)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6546 pthread_cond_broadcast (&(eve->event)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6547 eve->posted = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6548 pthread_mutex_unlock (&(eve->mutex)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6549 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6550 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6551 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6552 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6553 * Waits on a semaphore created by dw_event_new(), until the |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6554 * event gets posted or until the timeout expires. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6555 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6556 * eve: The handle to the event returned by dw_event_new(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6557 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6558 int dw_event_wait(HEV eve, unsigned long timeout) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6559 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6560 int rc; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6561 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6562 if(!eve) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6563 return DW_ERROR_NON_INIT; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6564 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6565 pthread_mutex_lock (&(eve->mutex)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6566 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6567 if(eve->posted) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6568 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6569 pthread_mutex_unlock (&(eve->mutex)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6570 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6571 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6572 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6573 if(timeout != -1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6574 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6575 struct timeval now; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6576 struct timespec timeo; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6577 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6578 gettimeofday(&now, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6579 timeo.tv_sec = now.tv_sec + (timeout / 1000); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6580 timeo.tv_nsec = now.tv_usec * 1000; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6581 rc = pthread_cond_timedwait(&(eve->event), &(eve->mutex), &timeo); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6582 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6583 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6584 rc = pthread_cond_wait(&(eve->event), &(eve->mutex)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6585 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6586 pthread_mutex_unlock (&(eve->mutex)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6587 if(!rc) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6588 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6589 if(rc == ETIMEDOUT) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6590 return DW_ERROR_TIMEOUT; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6591 return DW_ERROR_GENERAL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6592 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6593 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6594 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6595 * Closes a semaphore created by dw_event_new(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6596 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6597 * eve: The handle to the event returned by dw_event_new(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6598 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6599 int dw_event_close(HEV *eve) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6600 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6601 if(!eve || !(*eve)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6602 return DW_ERROR_NON_INIT; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6603 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6604 pthread_mutex_lock (&((*eve)->mutex)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6605 pthread_cond_destroy (&((*eve)->event)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6606 pthread_mutex_unlock (&((*eve)->mutex)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6607 pthread_mutex_destroy (&((*eve)->mutex)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6608 free(*eve); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6609 *eve = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6610 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6611 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6612 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6613 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6614 struct _seminfo { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6615 int fd; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6616 int waiting; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6617 }; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6618 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6619 static void _handle_sem(int *tmpsock) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6620 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6621 fd_set rd; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6622 struct _seminfo *array = (struct _seminfo *)malloc(sizeof(struct _seminfo)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6623 int listenfd = tmpsock[0]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6624 int bytesread, connectcount = 1, maxfd, z, posted = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6625 char command; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6626 sigset_t mask; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6627 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6628 sigfillset(&mask); /* Mask all allowed signals */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6629 pthread_sigmask(SIG_BLOCK, &mask, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6630 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6631 /* problems */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6632 if(tmpsock[1] == -1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6633 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6634 free(array); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6635 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6636 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6637 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6638 array[0].fd = tmpsock[1]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6639 array[0].waiting = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6640 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6641 /* Free the memory allocated in dw_named_event_new. */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6642 free(tmpsock); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6643 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6644 while(1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6645 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6646 FD_ZERO(&rd); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6647 FD_SET(listenfd, &rd); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6648 int DW_UNUSED(result); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6649 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6650 maxfd = listenfd; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6651 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6652 /* Added any connections to the named event semaphore */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6653 for(z=0;z<connectcount;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6654 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6655 if(array[z].fd > maxfd) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6656 maxfd = array[z].fd; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6657 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6658 FD_SET(array[z].fd, &rd); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6659 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6660 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6661 if(select(maxfd+1, &rd, NULL, NULL, NULL) == -1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6662 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6663 free(array); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6664 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6665 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6666 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6667 if(FD_ISSET(listenfd, &rd)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6668 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6669 struct _seminfo *newarray; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6670 int newfd = accept(listenfd, 0, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6671 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6672 if(newfd > -1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6673 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6674 /* Add new connections to the set */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6675 newarray = (struct _seminfo *)malloc(sizeof(struct _seminfo)*(connectcount+1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6676 memcpy(newarray, array, sizeof(struct _seminfo)*(connectcount)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6677 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6678 newarray[connectcount].fd = newfd; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6679 newarray[connectcount].waiting = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6680 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6681 connectcount++; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6682 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6683 /* Replace old array with new one */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6684 free(array); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6685 array = newarray; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6686 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6687 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6688 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6689 /* Handle any events posted to the semaphore */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6690 for(z=0;z<connectcount;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6691 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6692 if(FD_ISSET(array[z].fd, &rd)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6693 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6694 if((bytesread = read(array[z].fd, &command, 1)) < 1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6695 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6696 struct _seminfo *newarray; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6697 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6698 /* Remove this connection from the set */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6699 newarray = (struct _seminfo *)malloc(sizeof(struct _seminfo)*(connectcount-1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6700 if(!z) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6701 memcpy(newarray, &array[1], sizeof(struct _seminfo)*(connectcount-1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6702 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6703 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6704 memcpy(newarray, array, sizeof(struct _seminfo)*z); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6705 if(z!=(connectcount-1)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6706 memcpy(&newarray[z], &array[z+1], sizeof(struct _seminfo)*(z-connectcount-1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6707 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6708 connectcount--; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6709 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6710 /* Replace old array with new one */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6711 free(array); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6712 array = newarray; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6713 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6714 else if(bytesread == 1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6715 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6716 switch(command) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6717 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6718 case 0: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6719 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6720 /* Reset */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6721 posted = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6722 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6723 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6724 case 1: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6725 /* Post */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6726 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6727 int s; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6728 char tmp = (char)0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6729 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6730 posted = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6731 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6732 for(s=0;s<connectcount;s++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6733 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6734 /* The semaphore has been posted so |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6735 * we tell all the waiting threads to |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6736 * continue. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6737 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6738 if(array[s].waiting) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6739 result = write(array[s].fd, &tmp, 1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6740 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6741 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6742 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6743 case 2: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6744 /* Wait */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6745 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6746 char tmp = (char)0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6747 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6748 array[z].waiting = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6749 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6750 /* If we are posted exit immeditately */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6751 if(posted) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6752 result = write(array[z].fd, &tmp, 1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6753 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6754 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6755 case 3: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6756 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6757 /* Done Waiting */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6758 array[z].waiting = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6759 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6760 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6761 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6762 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6763 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6764 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6765 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6766 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6767 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6768 /* Using domain sockets on unix for IPC */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6769 /* Create a named event semaphore which can be |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6770 * opened from other processes. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6771 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6772 * eve: Pointer to an event handle to receive handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6773 * name: Name given to semaphore which can be opened |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6774 * by other processes. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6775 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6776 HEV dw_named_event_new(const char *name) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6777 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6778 struct sockaddr_un un; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6779 int ev, *tmpsock = (int *)malloc(sizeof(int)*2); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6780 DWTID dwthread; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6781 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6782 if(!tmpsock) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6783 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6784 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6785 tmpsock[0] = socket(AF_UNIX, SOCK_STREAM, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6786 ev = socket(AF_UNIX, SOCK_STREAM, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6787 memset(&un, 0, sizeof(un)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6788 un.sun_family=AF_UNIX; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6789 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6790 strcpy(un.sun_path, "/tmp/.dw/"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6791 strcat(un.sun_path, name); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6792 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6793 /* just to be safe, this should be changed |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6794 * to support multiple instances. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6795 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6796 remove(un.sun_path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6797 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6798 bind(tmpsock[0], (struct sockaddr *)&un, sizeof(un)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6799 listen(tmpsock[0], 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6800 connect(ev, (struct sockaddr *)&un, sizeof(un)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6801 tmpsock[1] = accept(tmpsock[0], 0, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6802 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6803 if(tmpsock[0] < 0 || tmpsock[1] < 0 || ev < 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6804 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6805 if(tmpsock[0] > -1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6806 close(tmpsock[0]); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6807 if(tmpsock[1] > -1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6808 close(tmpsock[1]); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6809 if(ev > -1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6810 close(ev); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6811 free(tmpsock); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6812 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6813 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6814 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6815 /* Create a thread to handle this event semaphore */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6816 pthread_create(&dwthread, NULL, (void *)_handle_sem, (void *)tmpsock); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6817 return GINT_TO_POINTER(ev); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6818 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6819 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6820 /* Open an already existing named event semaphore. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6821 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6822 * eve: Pointer to an event handle to receive handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6823 * name: Name given to semaphore which can be opened |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6824 * by other processes. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6825 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6826 HEV dw_named_event_get(const char *name) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6827 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6828 struct sockaddr_un un; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6829 int ev = socket(AF_UNIX, SOCK_STREAM, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6830 if(ev < 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6831 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6832 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6833 un.sun_family=AF_UNIX; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6834 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6835 strcpy(un.sun_path, "/tmp/.dw/"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6836 strcat(un.sun_path, name); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6837 connect(ev, (struct sockaddr *)&un, sizeof(un)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6838 return GINT_TO_POINTER(ev); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6839 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6840 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6841 /* Resets the event semaphore so threads who call wait |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6842 * on this semaphore will block. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6843 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6844 * eve: Handle to the semaphore obtained by |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6845 * an open or create call. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6846 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6847 int dw_named_event_reset(HEV eve) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6848 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6849 /* signal reset */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6850 char tmp = (char)0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6851 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6852 if(GPOINTER_TO_INT(eve) < 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6853 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6854 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6855 if(write(GPOINTER_TO_INT(eve), &tmp, 1) == 1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6856 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6857 return DW_ERROR_GENERAL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6858 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6859 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6860 /* Sets the posted state of an event semaphore, any threads |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6861 * waiting on the semaphore will no longer block. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6862 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6863 * eve: Handle to the semaphore obtained by |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6864 * an open or create call. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6865 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6866 int dw_named_event_post(HEV eve) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6867 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6868 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6869 /* signal post */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6870 char tmp = (char)1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6871 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6872 if(GPOINTER_TO_INT(eve) < 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6873 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6874 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6875 if(write(GPOINTER_TO_INT(eve), &tmp, 1) == 1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6876 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6877 return DW_ERROR_GENERAL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6878 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6879 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6880 /* Waits on the specified semaphore until it becomes |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6881 * posted, or returns immediately if it already is posted. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6882 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6883 * eve: Handle to the semaphore obtained by |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6884 * an open or create call. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6885 * timeout: Number of milliseconds before timing out |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6886 * or -1 if indefinite. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6887 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6888 int dw_named_event_wait(HEV eve, unsigned long timeout) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6889 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6890 fd_set rd; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6891 struct timeval tv, *useme = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6892 int retval = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6893 char tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6894 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6895 if(GPOINTER_TO_INT(eve) < 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6896 return DW_ERROR_NON_INIT; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6897 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6898 /* Set the timout or infinite */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6899 if(timeout != -1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6900 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6901 tv.tv_sec = timeout / 1000; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6902 tv.tv_usec = timeout % 1000; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6903 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6904 useme = &tv; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6905 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6906 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6907 FD_ZERO(&rd); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6908 FD_SET(GPOINTER_TO_INT(eve), &rd); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6909 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6910 /* Signal wait */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6911 tmp = (char)2; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6912 retval = write(GPOINTER_TO_INT(eve), &tmp, 1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6913 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6914 if(retval == 1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6915 retval = select(GPOINTER_TO_INT(eve)+1, &rd, NULL, NULL, useme); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6916 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6917 /* Signal done waiting. */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6918 tmp = (char)3; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6919 if(retval == 1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6920 retval = write(GPOINTER_TO_INT(eve), &tmp, 1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6921 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6922 if(retval == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6923 return DW_ERROR_TIMEOUT; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6924 else if(retval == -1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6925 return DW_ERROR_INTERRUPT; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6926 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6927 /* Clear the entry from the pipe so |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6928 * we don't loop endlessly. :) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6929 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6930 if(read(GPOINTER_TO_INT(eve), &tmp, 1) == 1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6931 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6932 return DW_ERROR_GENERAL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6933 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6934 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6935 /* Release this semaphore, if there are no more open |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6936 * handles on this semaphore the semaphore will be destroyed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6937 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6938 * eve: Handle to the semaphore obtained by |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6939 * an open or create call. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6940 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6941 int dw_named_event_close(HEV eve) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6942 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6943 /* Finally close the domain socket, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6944 * cleanup will continue in _handle_sem. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6945 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6946 close(GPOINTER_TO_INT(eve)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6947 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6948 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6949 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6950 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6951 * Generally an internal function called from a newly created |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6952 * thread to setup the Dynamic Windows environment for the thread. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6953 * However it is exported so language bindings can call it when |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6954 * they create threads that require access to Dynamic Windows. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6955 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6956 void API _dw_init_thread(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6957 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6958 GdkRGBA *foreground = malloc(sizeof(GdkRGBA)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6959 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6960 foreground->alpha = foreground->red = foreground->green = foreground->blue = 0.0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6961 pthread_setspecific(_dw_fg_color_key, foreground); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6962 pthread_setspecific(_dw_bg_color_key, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6963 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6964 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6965 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6966 * Generally an internal function called from a terminating |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6967 * thread to cleanup the Dynamic Windows environment for the thread. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6968 * However it is exported so language bindings can call it when |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6969 * they exit threads that require access to Dynamic Windows. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6970 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6971 void API _dw_deinit_thread(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6972 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6973 GdkRGBA *foreground, *background; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6974 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6975 if((foreground = pthread_getspecific(_dw_fg_color_key))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6976 free(foreground); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6977 if((background = pthread_getspecific(_dw_bg_color_key))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6978 free(background); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6979 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6980 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6981 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6982 * Setup thread independent color sets. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6983 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6984 void _dwthreadstart(void *data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6985 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6986 void (*threadfunc)(void *) = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6987 void **tmp = (void **)data; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6988 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6989 threadfunc = (void (*)(void *))tmp[0]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6990 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6991 /* Initialize colors */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6992 _dw_init_thread(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6993 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6994 threadfunc(tmp[1]); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6995 free(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6996 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6997 /* Free colors */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6998 _dw_deinit_thread(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6999 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7000 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7001 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7002 * Allocates a shared memory region with a name. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7003 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7004 * handle: A pointer to receive a SHM identifier. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7005 * dest: A pointer to a pointer to receive the memory address. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7006 * size: Size in bytes of the shared memory region to allocate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7007 * name: A string pointer to a unique memory name. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7008 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7009 HSHM dw_named_memory_new(void **dest, int size, const char *name) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7010 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7011 char namebuf[1025]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7012 struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7013 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7014 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7015 snprintf(namebuf, 1024, "/tmp/.dw/%s", name); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7016 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7017 if((handle->fd = open(namebuf, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR)) < 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7018 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7019 free(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7020 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7021 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7022 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7023 if(ftruncate(handle->fd, size)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7024 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7025 close(handle->fd); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7026 free(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7027 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7028 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7029 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7030 /* attach the shared memory segment to our process's address space. */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7031 *dest = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, handle->fd, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7032 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7033 if(*dest == MAP_FAILED) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7034 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7035 close(handle->fd); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7036 *dest = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7037 free(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7038 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7039 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7040 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7041 handle->size = size; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7042 handle->sid = getsid(0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7043 handle->path = strdup(namebuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7044 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7045 return handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7046 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7047 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7048 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7049 * Aquires shared memory region with a name. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7050 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7051 * dest: A pointer to a pointer to receive the memory address. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7052 * size: Size in bytes of the shared memory region to requested. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7053 * name: A string pointer to a unique memory name. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7054 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7055 HSHM dw_named_memory_get(void **dest, int size, const char *name) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7056 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7057 char namebuf[1025]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7058 struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7059 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7060 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7061 snprintf(namebuf, 1024, "/tmp/.dw/%s", name); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7062 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7063 if((handle->fd = open(namebuf, O_RDWR)) < 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7064 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7065 free(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7066 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7067 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7068 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7069 /* attach the shared memory segment to our process's address space. */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7070 *dest = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, handle->fd, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7071 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7072 if(*dest == MAP_FAILED) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7073 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7074 close(handle->fd); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7075 *dest = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7076 free(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7077 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7078 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7079 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7080 handle->size = size; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7081 handle->sid = -1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7082 handle->path = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7083 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7084 return handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7085 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7086 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7087 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7088 * Frees a shared memory region previously allocated. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7089 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7090 * handle: Handle obtained from DB_named_memory_allocate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7091 * ptr: The memory address aquired with DB_named_memory_allocate. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7092 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7093 int dw_named_memory_free(HSHM handle, void *ptr) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7094 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7095 struct _dw_unix_shm *h = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7096 int rc = munmap(ptr, h->size); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7097 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7098 close(h->fd); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7099 if(h->path) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7100 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7101 /* Only remove the actual file if we are the |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7102 * creator of the file. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7103 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7104 if(h->sid != -1 && h->sid == getsid(0)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7105 remove(h->path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7106 free(h->path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7107 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7108 return rc; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7109 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7110 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7111 * Creates a new thread with a starting point of func. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7112 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7113 * func: Function which will be run in the new thread. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7114 * data: Parameter(s) passed to the function. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7115 * stack: Stack size of new thread (OS/2 and Windows only). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7116 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7117 DWTID dw_thread_new(void *func, void *data, int stack) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7118 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7119 DWTID gtkthread; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7120 void **tmp = malloc(sizeof(void *) * 2); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7121 int rc; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7122 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7123 tmp[0] = func; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7124 tmp[1] = data; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7125 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7126 rc = pthread_create(>kthread, NULL, (void *)_dwthreadstart, (void *)tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7127 if ( rc == 0 ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7128 return gtkthread; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7129 return (DWTID)DW_ERROR_UNKNOWN; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7130 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7131 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7132 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7133 * Ends execution of current thread immediately. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7134 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7135 void dw_thread_end(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7136 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7137 pthread_exit(NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7138 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7139 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7140 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7141 * Returns the current thread's ID. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7142 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7143 DWTID dw_thread_id(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7144 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7145 return (DWTID)pthread_self(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7146 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7147 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7148 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7149 * Cleanly terminates a DW session, should be signal handler safe. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7150 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7151 void dw_shutdown(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7152 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7153 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7154 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7155 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7156 * Cleanly terminates a DW session, should be signal handler safe. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7157 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7158 * exitcode: Exit code reported to the operating system. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7159 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7160 void dw_exit(int exitcode) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7161 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7162 exit(exitcode); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7163 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7164 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7165 /* Internal function to get the recommended size of scrolled items */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7166 void _get_scrolled_size(GtkWidget *item, gint *thiswidth, gint *thisheight) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7167 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7168 GtkWidget *widget = g_object_get_data(G_OBJECT(item), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7169 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7170 *thisheight = *thiswidth = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7171 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7172 if(widget) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7173 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7174 if(g_object_get_data(G_OBJECT(widget), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_TREE)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7175 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7176 /* Set to half for tree */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7177 *thiswidth = (int)((_DW_SCROLLED_MAX_WIDTH + _DW_SCROLLED_MIN_WIDTH)/2); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7178 *thisheight = (int)((_DW_SCROLLED_MAX_HEIGHT + _DW_SCROLLED_MIN_HEIGHT)/2); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7179 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7180 else if(GTK_IS_TEXT_VIEW(widget)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7181 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7182 unsigned long bytes; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7183 int height, width; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7184 char *buf, *ptr; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7185 int wrap = (gtk_text_view_get_wrap_mode(GTK_TEXT_VIEW(widget)) == GTK_WRAP_WORD); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7186 static char testtext[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7187 int hscrolled = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7188 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7189 *thiswidth = *thisheight = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7190 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7191 dw_mle_get_size(item, &bytes, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7192 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7193 ptr = buf = alloca(bytes + 2); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7194 dw_mle_export(item, buf, 0, (int)bytes); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7195 buf[bytes] = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7196 strcat(buf, "\r"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7197 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7198 /* MLE */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7199 while((ptr = strstr(buf, "\r"))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7200 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7201 ptr[0] = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7202 width = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7203 if(strlen(buf)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7204 dw_font_text_extents_get(item, NULL, buf, &width, &height); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7205 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7206 dw_font_text_extents_get(item, NULL, testtext, NULL, &height); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7207 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7208 if(wrap && width > _DW_SCROLLED_MAX_WIDTH) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7209 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7210 *thiswidth = _DW_SCROLLED_MAX_WIDTH; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7211 *thisheight += height * (width / _DW_SCROLLED_MAX_WIDTH); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7212 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7213 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7214 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7215 if(width > *thiswidth) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7216 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7217 if(width > _DW_SCROLLED_MAX_WIDTH) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7218 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7219 *thiswidth = _DW_SCROLLED_MAX_WIDTH; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7220 hscrolled = TRUE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7221 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7222 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7223 *thiswidth = width; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7224 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7225 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7226 *thisheight += height; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7227 if(ptr[1] == '\n') |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7228 buf = &ptr[2]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7229 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7230 buf = &ptr[1]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7231 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7232 if(hscrolled) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7233 *thisheight += 10; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7234 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7235 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7236 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7237 gtk_widget_get_preferred_height(GTK_WIDGET(widget), NULL, thisheight); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7238 gtk_widget_get_preferred_width(GTK_WIDGET(widget), NULL, thiswidth); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7239 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7240 *thisheight += 20; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7241 *thiswidth += 20; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7242 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7243 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7244 if(*thiswidth < _DW_SCROLLED_MIN_WIDTH) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7245 *thiswidth = _DW_SCROLLED_MIN_WIDTH; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7246 if(*thiswidth > _DW_SCROLLED_MAX_WIDTH) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7247 *thiswidth = _DW_SCROLLED_MAX_WIDTH; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7248 if(*thisheight < _DW_SCROLLED_MIN_HEIGHT) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7249 *thisheight = _DW_SCROLLED_MIN_HEIGHT; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7250 if(*thisheight > _DW_SCROLLED_MAX_HEIGHT) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7251 *thisheight = _DW_SCROLLED_MAX_HEIGHT; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7252 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7253 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7254 /* Internal box packing function called by the other 3 functions */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7255 void _dw_box_pack(HWND box, HWND item, int index, int width, int height, int hsize, int vsize, int pad, char *funcname) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7256 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7257 int warn = FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7258 GtkWidget *tmp, *tmpitem, *image = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7259 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7260 if(!box) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7261 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7262 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7263 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7264 * If you try and pack an item into itself VERY bad things can happen; like at least an |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7265 * infinite loop on GTK! Lets be safe! |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7266 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7267 if(box == item) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7268 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7269 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7270 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7271 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7272 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7273 /* If this is a special box, like: Window, Groupbox, Scrollbox... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7274 * get the internal box handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7275 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7276 if((tmp = g_object_get_data(G_OBJECT(box), "_dw_boxhandle"))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7277 box = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7278 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7279 /* Can't pack nothing with GTK, so create an empty label */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7280 if(!item) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7281 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7282 item = gtk_label_new(""); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7283 g_object_set_data(G_OBJECT(item), "_dw_padding", GINT_TO_POINTER(1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7284 gtk_widget_show_all(item); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7285 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7286 /* Due to GTK3 minimum size limitations, if we are packing a widget |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7287 * with an image, we need to scale the image down to fit the packed size. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7288 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7289 else if((image = g_object_get_data(G_OBJECT(item), "_dw_bitmap"))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7290 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7291 GdkPixbuf *pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(image)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7292 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7293 if(pixbuf) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7294 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7295 int pwidth = gdk_pixbuf_get_width(pixbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7296 int pheight = gdk_pixbuf_get_height(pixbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7297 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7298 if(width == -1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7299 width = pwidth; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7300 if(height == -1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7301 height = pheight; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7302 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7303 if(pwidth > width || pheight > height) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7304 pixbuf = gdk_pixbuf_scale_simple(pixbuf, pwidth > width ? width : pwidth, pheight > height ? height : pheight, GDK_INTERP_BILINEAR); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7305 gtk_image_set_from_pixbuf(GTK_IMAGE(image), pixbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7306 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7307 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7308 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7309 /* Check if the item to be packed is a special box */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7310 tmpitem = (GtkWidget *)g_object_get_data(G_OBJECT(item), "_dw_boxhandle"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7311 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7312 /* Make sure our target box is valid */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7313 if(GTK_IS_GRID(box)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7314 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7315 int boxcount = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(box), "_dw_boxcount")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7316 int boxtype = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(box), "_dw_boxtype")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7317 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7318 /* If the item being packed is a box, then we use it's padding |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7319 * instead of the padding specified on the pack line, this is |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7320 * due to a bug in the OS/2 and Win32 renderer and a limitation |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7321 * of the GtkTable class. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7322 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7323 if(GTK_IS_GRID(item) || (tmpitem && GTK_IS_GRID(tmpitem))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7324 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7325 GtkWidget *eventbox = (GtkWidget *)g_object_get_data(G_OBJECT(item), "_dw_eventbox"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7326 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7327 /* NOTE: I left in the ability to pack boxes with a size, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7328 * this eliminates that by forcing the size to 0. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7329 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7330 height = width = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7331 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7332 if(eventbox) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7333 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7334 int boxpad = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(item), "_dw_boxpad")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7335 gtk_container_add(GTK_CONTAINER(eventbox), item); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7336 gtk_container_set_border_width(GTK_CONTAINER(eventbox), boxpad); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7337 item = eventbox; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7338 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7339 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7340 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7341 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7342 /* Only show warning if item is not a box */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7343 warn = TRUE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7344 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7345 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7346 /* Do some sanity bounds checking */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7347 if(index < 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7348 index = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7349 if(index > boxcount) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7350 index = boxcount; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7351 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7352 g_object_set_data(G_OBJECT(item), "_dw_table", box); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7353 /* Set the expand attribute on the widgets now instead of the container */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7354 gtk_widget_set_vexpand(item, vsize); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7355 gtk_widget_set_valign(item, vsize ? GTK_ALIGN_FILL : GTK_ALIGN_START); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7356 gtk_widget_set_hexpand(item, hsize); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7357 gtk_widget_set_halign(item, hsize ? GTK_ALIGN_FILL : GTK_ALIGN_START); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7358 /* Use the margin property as padding */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7359 g_object_set(G_OBJECT(item), "margin", pad, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7360 /* Add to the grid using insert... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7361 * rows for vertical boxes and columns for horizontal. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7362 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7363 if(boxtype == DW_VERT) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7364 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7365 gtk_grid_insert_row(GTK_GRID(box), index); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7366 gtk_grid_attach(GTK_GRID(box), item, 0, index, 1, 1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7367 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7368 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7369 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7370 gtk_grid_insert_column(GTK_GRID(box), index); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7371 gtk_grid_attach(GTK_GRID(box), item, index, 0, 1, 1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7372 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7373 g_object_set_data(G_OBJECT(box), "_dw_boxcount", GINT_TO_POINTER(boxcount + 1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7374 /* Special case for scrolled windows */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7375 if(GTK_IS_SCROLLED_WINDOW(item)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7376 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7377 gint scrolledwidth = 0, scrolledheight = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7378 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7379 /* Pre-run the calculation code for MLE/Container/Tree if needed */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7380 if((width < 1 && !hsize) || (height < 1 && !vsize)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7381 _get_scrolled_size(item, &scrolledwidth, &scrolledheight); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7382 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7383 if(width > 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7384 gtk_scrolled_window_set_min_content_width(GTK_SCROLLED_WINDOW(item), width); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7385 else if(!hsize) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7386 gtk_scrolled_window_set_min_content_width(GTK_SCROLLED_WINDOW(item), scrolledwidth); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7387 if(height > 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7388 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(item), height); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7389 else if(!vsize) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7390 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(item), scrolledheight); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7391 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7392 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7393 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7394 /* Set the requested size of the widget */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7395 if(width == -1 && (GTK_IS_COMBO_BOX(item) || GTK_IS_ENTRY(item))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7396 gtk_widget_set_size_request(item, 150, height); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7397 else if(width == -1 && GTK_IS_SPIN_BUTTON(item)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7398 gtk_widget_set_size_request(item, 50, height); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7399 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7400 gtk_widget_set_size_request(item, width, height); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7401 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7402 if(GTK_IS_RADIO_BUTTON(item)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7403 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7404 GSList *group; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7405 GtkWidget *groupstart = (GtkWidget *)g_object_get_data(G_OBJECT(box), "_dw_group"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7406 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7407 if(groupstart) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7408 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7409 group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(groupstart)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7410 gtk_radio_button_set_group(GTK_RADIO_BUTTON(item), group); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7411 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7412 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7413 g_object_set_data(G_OBJECT(box), "_dw_group", (gpointer)item); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7414 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7415 /* If we previously incremented the reference count... drop it now that it is packed */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7416 if(g_object_get_data(G_OBJECT(item), "_dw_refed")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7417 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7418 g_object_unref(G_OBJECT(item)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7419 g_object_set_data(G_OBJECT(item), "_dw_refed", NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7420 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7421 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7422 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7423 if(warn) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7424 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7425 if ( width == 0 && hsize == FALSE ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7426 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7427 if ( height == 0 && vsize == FALSE ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7428 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7429 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7430 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7431 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7432 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7433 * Remove windows (widgets) from the box they are packed into. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7434 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7435 * handle: Window handle of the packed item to be removed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7436 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7437 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7438 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7439 int API dw_box_unpack(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7440 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7441 int retcode = DW_ERROR_GENERAL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7442 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7443 if(GTK_IS_WIDGET(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7444 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7445 GtkWidget *box, *handle2 = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7446 GtkWidget *eventbox = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_eventbox"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7447 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7448 /* Handle the invisible event box if it exists */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7449 if(eventbox && GTK_IS_WIDGET(eventbox)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7450 handle2 = eventbox; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7451 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7452 /* Check if we are removing a widget from a box */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7453 if((box = gtk_widget_get_parent(handle2)) && GTK_IS_GRID(box)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7454 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7455 /* Get the number of items in the box... */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7456 int boxcount = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(box), "_dw_boxcount")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7457 int boxtype = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(box), "_dw_boxtype")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7458 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7459 if(boxcount > 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7460 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7461 /* Decrease the count by 1 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7462 boxcount--; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7463 g_object_set_data(G_OBJECT(box), "_dw_boxcount", GINT_TO_POINTER(boxcount)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7464 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7465 /* If we haven't incremented the reference count... raise it before removal */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7466 if(!g_object_get_data(G_OBJECT(handle2), "_dw_refed")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7467 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7468 g_object_ref(G_OBJECT(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7469 g_object_set_data(G_OBJECT(handle2), "_dw_refed", GINT_TO_POINTER(1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7470 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7471 /* Remove the widget from the box */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7472 /* Figure out where in the grid this widget is and remove that row/column */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7473 if(boxtype == DW_VERT) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7474 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7475 int z; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7476 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7477 for(z=0;z<boxcount;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7478 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7479 if(gtk_grid_get_child_at(GTK_GRID(box), 0, z) == handle2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7480 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7481 gtk_grid_remove_row(GTK_GRID(box), z); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7482 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7483 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7484 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7485 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7486 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7487 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7488 int z; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7489 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7490 for(z=0;z<boxcount;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7491 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7492 if(gtk_grid_get_child_at(GTK_GRID(box), z, 0) == handle2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7493 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7494 gtk_grid_remove_column(GTK_GRID(box), z); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7495 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7496 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7497 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7498 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7499 retcode = DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7500 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7501 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7502 return retcode; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7503 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7504 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7505 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7506 * Remove windows (widgets) from a box at an arbitrary location. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7507 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7508 * box: Window handle of the box to be removed from. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7509 * index: 0 based index of packed items. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7510 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7511 * Handle to the removed item on success, 0 on failure or padding. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7512 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7513 HWND API dw_box_unpack_at_index(HWND box, int index) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7514 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7515 HWND retval = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7516 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7517 /* Check if we are removing a widget from a box */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7518 if(GTK_IS_GRID(box)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7519 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7520 /* Get the number of items in the box... */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7521 int boxcount = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(box), "_dw_boxcount")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7522 int boxtype = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(box), "_dw_boxtype")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7523 GtkWidget *item = (boxtype == DW_VERT) ? gtk_grid_get_child_at(GTK_GRID(box), 0, index) : gtk_grid_get_child_at(GTK_GRID(box), index, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7524 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7525 if(boxcount > 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7526 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7527 /* Decrease the count by 1 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7528 boxcount--; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7529 g_object_set_data(G_OBJECT(box), "_dw_boxcount", GINT_TO_POINTER(boxcount)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7530 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7531 /* If we haven't incremented the reference count... raise it before removal */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7532 if(item && g_object_get_data(G_OBJECT(item), "_dw_padding")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7533 gtk_widget_destroy(item); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7534 else if(item) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7535 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7536 if(!g_object_get_data(G_OBJECT(item), "_dw_refed")) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7537 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7538 g_object_ref(G_OBJECT(item)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7539 g_object_set_data(G_OBJECT(item), "_dw_refed", GINT_TO_POINTER(1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7540 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7541 /* Remove the widget from the box */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7542 gtk_container_remove(GTK_CONTAINER(box), item); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7543 if(boxtype == DW_VERT) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7544 gtk_grid_remove_row(GTK_GRID(box), index); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7545 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7546 gtk_grid_remove_column(GTK_GRID(box), index); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7547 retval = item; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7548 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7549 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7550 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7551 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7552 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7553 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7554 * Pack windows (widgets) into a box at an arbitrary location. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7555 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7556 * box: Window handle of the box to be packed into. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7557 * item: Window handle of the item to pack. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7558 * index: 0 based index of packed items. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7559 * width: Width in pixels of the item or -1 to be self determined. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7560 * height: Height in pixels of the item or -1 to be self determined. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7561 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7562 * vsize: TRUE if the window (widget) should expand vertically to fill space given. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7563 * pad: Number of pixels of padding around the item. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7564 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7565 void API dw_box_pack_at_index(HWND box, HWND item, int index, int width, int height, int hsize, int vsize, int pad) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7566 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7567 _dw_box_pack(box, item, index, width, height, hsize, vsize, pad, "dw_box_pack_at_index()"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7568 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7569 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7570 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7571 * Pack windows (widgets) into a box from the start (or top). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7572 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7573 * box: Window handle of the box to be packed into. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7574 * item: Window handle of the item to pack. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7575 * width: Width in pixels of the item or -1 to be self determined. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7576 * height: Height in pixels of the item or -1 to be self determined. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7577 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7578 * vsize: TRUE if the window (widget) should expand vertically to fill space given. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7579 * pad: Number of pixels of padding around the item. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7580 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7581 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7582 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7583 /* 65536 is the table limit on GTK... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7584 * seems like a high enough value we will never hit it here either. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7585 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7586 _dw_box_pack(box, item, 65536, width, height, hsize, vsize, pad, "dw_box_pack_start()"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7587 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7588 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7589 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7590 * Pack windows (widgets) into a box from the end (or bottom). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7591 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7592 * box: Window handle of the box to be packed into. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7593 * item: Window handle of the item to pack. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7594 * width: Width in pixels of the item or -1 to be self determined. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7595 * height: Height in pixels of the item or -1 to be self determined. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7596 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7597 * vsize: TRUE if the window (widget) should expand vertically to fill space given. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7598 * pad: Number of pixels of padding around the item. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7599 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7600 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7601 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7602 _dw_box_pack(box, item, 0, width, height, hsize, vsize, pad, "dw_box_pack_end()"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7603 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7604 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7605 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7606 union extents_union { guchar **gu_extents; unsigned long **extents; }; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7607 static GdkAtom extents_atom = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7608 static time_t extents_time = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7609 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7610 static gboolean _dw_property_notify(GtkWidget *window, GdkEventProperty* event, GdkWindow *gdkwindow) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7611 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7612 /* Check to see if we got a property change */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7613 if(event->state == GDK_PROPERTY_NEW_VALUE && event->atom == extents_atom && event->window == gdkwindow) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7614 extents_time = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7615 return FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7616 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7617 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7618 /* Internal function to figure out the frame extents of an unmapped window */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7619 void _dw_get_frame_extents(GtkWidget *window, int *vert, int *horz) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7620 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7621 if(gtk_window_get_decorated(GTK_WINDOW(window))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7622 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7623 const char *request = "_NET_REQUEST_FRAME_EXTENTS"; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7624 unsigned long *extents = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7625 union extents_union eu; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7626 GdkAtom request_extents = gdk_atom_intern(request, FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7627 GdkWindow *gdkwindow = gtk_widget_get_window(window); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7628 GdkDisplay *display = gtk_widget_get_display(window); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7629 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7630 if(!extents_atom) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7631 extents_atom = gdk_atom_intern("_NET_FRAME_EXTENTS", FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7632 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7633 /* Set some rational defaults.. just in case */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7634 *vert = 28; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7635 *horz = 12; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7636 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7637 /* See if the current window manager supports _NET_REQUEST_FRAME_EXTENTS */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7638 if(gdk_x11_screen_supports_net_wm_hint(gdk_screen_get_default(), request_extents)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7639 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7640 Display *xdisplay = GDK_DISPLAY_XDISPLAY(display); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7641 GdkWindow *root_window = gdk_get_default_root_window(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7642 Window xroot_window = GDK_WINDOW_XID(root_window); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7643 Atom extents_request_atom = gdk_x11_get_xatom_by_name_for_display(display, request); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7644 unsigned long window_id = GDK_WINDOW_XID(gdkwindow); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7645 XEvent xevent = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7646 time_t currtime; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7647 gulong connid; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7648 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7649 xevent.xclient.type = ClientMessage; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7650 xevent.xclient.message_type = extents_request_atom; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7651 xevent.xclient.display = xdisplay; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7652 xevent.xclient.window = window_id; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7653 xevent.xclient.format = 32; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7654 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7655 /* Send the property request */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7656 XSendEvent(xdisplay, xroot_window, False, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7657 (SubstructureRedirectMask | SubstructureNotifyMask), |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7658 &xevent); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7659 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7660 /* Connect a signal to look for the property change */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7661 connid = g_signal_connect(G_OBJECT(window), "property_notify_event", G_CALLBACK(_dw_property_notify), gdkwindow); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7662 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7663 /* Record the request time */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7664 time(&extents_time); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7665 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7666 /* Look for the property notify event */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7667 do |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7668 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7669 dw_main_iteration(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7670 time(&currtime); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7671 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7672 while(currtime - extents_time < 2); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7673 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7674 /* Remove the signal handler now that we are done */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7675 g_signal_handler_disconnect(G_OBJECT(window), connid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7676 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7677 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7678 /* Attempt to retrieve window's frame extents. */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7679 eu.extents = &extents; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7680 if(gdk_property_get(gdkwindow, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7681 extents_atom, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7682 gdk_atom_intern("CARDINAL", FALSE), |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7683 0, sizeof(unsigned long)*4, FALSE, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7684 NULL, NULL, NULL, eu.gu_extents)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7685 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7686 *horz = extents[0] + extents[1]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7687 *vert = extents[2] + extents[3]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7688 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7689 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7690 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7691 *horz = *vert = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7692 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7693 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7694 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7695 * Sets the size of a given window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7696 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7697 * handle: Window (widget) handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7698 * width: New width in pixels. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7699 * height: New height in pixels. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7700 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7701 void dw_window_set_size(HWND handle, unsigned long width, unsigned long height) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7702 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7703 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7704 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7705 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7706 if(GTK_IS_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7707 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7708 GdkWindow *window = gtk_widget_get_window(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7709 int cx = 0, cy = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7710 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7711 /* Window is mapped query the frame size directly */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7712 if(window && gtk_widget_get_mapped(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7713 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7714 GdkRectangle frame; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7715 gint gwidth, gheight; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7716 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7717 /* Calculate the border size */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7718 gdk_window_get_frame_extents(window, &frame); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7719 gdk_window_get_geometry(window, NULL, NULL, &gwidth, &gheight); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7720 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7721 cx = frame.width - gwidth; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7722 if(cx < 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7723 cx = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7724 cy = frame.height - gheight; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7725 if(cy < 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7726 cy = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7727 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7728 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7729 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7730 /* Check if we have cached frame size values */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7731 if(!((cx = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_frame_width"))) | |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7732 (cy = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_frame_height"))))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7733 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7734 /* If not try to ask the window manager for the estimated size... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7735 * and finally if all else fails, guess. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7736 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7737 _dw_get_frame_extents(handle, &cy, &cx); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7738 /* Cache values for later use */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7739 g_object_set_data(G_OBJECT(handle), "_dw_frame_width", GINT_TO_POINTER(cx)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7740 g_object_set_data(G_OBJECT(handle), "_dw_frame_height", GINT_TO_POINTER(cy)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7741 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7742 /* Save the size for when it is shown */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7743 g_object_set_data(G_OBJECT(handle), "_dw_width", GINT_TO_POINTER(width)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7744 g_object_set_data(G_OBJECT(handle), "_dw_height", GINT_TO_POINTER(height)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7745 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7746 /* Resize minus the border size */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7747 if(width > cx && height > cy) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7748 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7749 gtk_window_resize(GTK_WINDOW(handle), width - cx , height - cy ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7750 gtk_window_set_default_size(GTK_WINDOW(handle), width - cx, height - cy); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7751 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7752 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7753 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7754 gtk_widget_set_size_request(handle, width, height); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7755 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7756 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7757 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7758 * Gets the size the system thinks the widget should be. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7759 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7760 * handle: Window handle of the item to be back. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7761 * width: Width in pixels of the item or NULL if not needed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7762 * height: Height in pixels of the item or NULL if not needed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7763 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7764 void API dw_window_get_preferred_size(HWND handle, int *width, int *height) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7765 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7766 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7767 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7768 gint scrolledwidth, scrolledheight; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7769 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7770 _get_scrolled_size(handle, &scrolledwidth, &scrolledheight); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7771 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7772 if(width) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7773 *width = scrolledwidth; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7774 if(height) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7775 *height = scrolledheight; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7776 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7777 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7778 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7779 if(width) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7780 gtk_widget_get_preferred_width(handle, NULL, width); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7781 if(height) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7782 gtk_widget_get_preferred_height(handle, NULL, height); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7783 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7784 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7785 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7786 /* Internal version to simplify the code with multiple versions of GTK */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7787 int _dw_screen_width(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7788 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7789 GdkDisplay *display = gdk_display_get_default(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7790 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7791 if(display) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7792 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7793 GdkMonitor *monitor = gdk_display_get_primary_monitor(display); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7794 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7795 if(monitor) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7796 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7797 GdkRectangle rc = { 0, 0, 0 ,0 }; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7798 gdk_monitor_get_geometry(monitor, &rc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7799 return rc.width; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7800 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7801 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7802 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7803 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7804 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7805 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7806 * Returns the width of the screen. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7807 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7808 int dw_screen_width(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7809 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7810 return _dw_screen_width(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7811 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7812 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7813 /* Internal version to simplify the code with multiple versions of GTK */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7814 int _dw_screen_height(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7815 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7816 GdkDisplay *display = gdk_display_get_default(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7817 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7818 if(display) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7819 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7820 GdkMonitor *monitor = gdk_display_get_primary_monitor(display); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7821 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7822 if(monitor) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7823 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7824 GdkRectangle rc = { 0, 0, 0 ,0 }; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7825 gdk_monitor_get_geometry(monitor, &rc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7826 return rc.height; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7827 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7828 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7829 return 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7830 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7831 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7832 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7833 * Returns the height of the screen. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7834 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7835 int dw_screen_height(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7836 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7837 return _dw_screen_height(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7838 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7839 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7840 /* This should return the current color depth */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7841 unsigned long dw_color_depth_get(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7842 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7843 GdkVisual *vis = gdk_screen_get_system_visual(gdk_screen_get_default()); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7844 return gdk_visual_get_depth(vis); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7845 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7846 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7847 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7848 * Sets the gravity of a given window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7849 * Gravity controls which corner of the screen and window the position is relative to. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7850 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7851 * handle: Window (widget) handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7852 * horz: DW_GRAV_LEFT (default), DW_GRAV_RIGHT or DW_GRAV_CENTER. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7853 * vert: DW_GRAV_TOP (default), DW_GRAV_BOTTOM or DW_GRAV_CENTER. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7854 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7855 void API dw_window_set_gravity(HWND handle, int horz, int vert) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7856 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7857 dw_window_set_data(handle, "_dw_grav_horz", DW_INT_TO_POINTER(horz)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7858 dw_window_set_data(handle, "_dw_grav_vert", DW_INT_TO_POINTER(vert)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7859 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7860 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7861 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7862 * Sets the position of a given window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7863 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7864 * handle: Window (widget) handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7865 * x: X location from the bottom left. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7866 * y: Y location from the bottom left. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7867 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7868 void dw_window_set_pos(HWND handle, long x, long y) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7869 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7870 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7871 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7872 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7873 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7874 GdkWindow *window = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7875 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7876 if(GTK_IS_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7877 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7878 GdkWindow *window = gtk_widget_get_window(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7879 int horz = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_grav_horz")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7880 int vert = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_grav_vert")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7881 int cx = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_frame_width")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7882 int cy = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_frame_height")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7883 int newx = x, newy = y, width = 0, height = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7884 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7885 /* If the window is mapped */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7886 if(window && gtk_widget_get_mapped(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7887 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7888 /* If we need the width or height... */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7889 if(horz || vert) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7890 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7891 GdkRectangle frame; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7892 int count = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7893 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7894 /* Get the frame size */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7895 gdk_window_get_frame_extents(window, &frame); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7896 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7897 /* FIXME: Sometimes we get returned an invalid 200x200 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7898 * result... so if we get this... try the call a second |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7899 * time and hope for a better result. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7900 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7901 while((frame.width == 200 || frame.width == (200 + cx)) && |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7902 (frame.height == 200 || frame.height == (200 + cy)) && count < 10) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7903 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7904 _dw_msleep(1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7905 count++; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7906 gdk_window_get_frame_extents(window, &frame); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7907 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7908 width = frame.width; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7909 height = frame.height; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7910 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7911 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7912 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7913 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7914 /* Check if we have cached frame size values */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7915 if(!(cx | cy)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7916 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7917 /* If not try to ask the window manager for the estimated size... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7918 * and finally if all else fails, guess. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7919 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7920 _dw_get_frame_extents(handle, &cy, &cx); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7921 /* Cache values for later use */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7922 g_object_set_data(G_OBJECT(handle), "_dw_frame_width", GINT_TO_POINTER(cx)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7923 g_object_set_data(G_OBJECT(handle), "_dw_frame_height", GINT_TO_POINTER(cy)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7924 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7925 /* Save the positions for when it is shown */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7926 g_object_set_data(G_OBJECT(handle), "_dw_x", GINT_TO_POINTER(x)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7927 g_object_set_data(G_OBJECT(handle), "_dw_y", GINT_TO_POINTER(y)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7928 g_object_set_data(G_OBJECT(handle), "_dw_pos", GINT_TO_POINTER(1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7929 /* Check to see if there is a pending size request too */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7930 width = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_width")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7931 height = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_height")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7932 if(!width || !height) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7933 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7934 /* Ask what GTK is planning on suggesting for the window size */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7935 gtk_window_get_size(GTK_WINDOW(handle), !width ? &width : NULL, !height ? &height : NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7936 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7937 /* Add the frame size to it */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7938 width += cx; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7939 height += cy; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7940 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7941 /* Do any gravity calculations */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7942 if(horz || vert) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7943 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7944 /* Handle horizontal center gravity */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7945 if((horz & 0xf) == DW_GRAV_CENTER) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7946 newx += ((_dw_screen_width() / 2) - (width / 2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7947 /* Handle right gravity */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7948 else if((horz & 0xf) == DW_GRAV_RIGHT) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7949 newx = _dw_screen_width() - width - x; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7950 /* Handle vertical center gravity */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7951 if((vert & 0xf) == DW_GRAV_CENTER) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7952 newy += ((_dw_screen_height() / 2) - (height / 2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7953 else if((vert & 0xf) == DW_GRAV_BOTTOM) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7954 newy = _dw_screen_height() - height - y; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7955 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7956 /* Adjust the values to avoid Gnome bar if requested */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7957 if((horz | vert) & DW_GRAV_OBSTACLES) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7958 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7959 GdkRectangle rect = { 0, 0, 0, 0 }; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7960 GdkDisplay *display = gdk_display_get_default(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7961 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7962 if(display) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7963 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7964 GdkMonitor *monitor = gdk_display_get_primary_monitor(display); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7965 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7966 if(monitor) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7967 gdk_monitor_get_workarea(monitor, &rect); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7968 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7969 if(horz & DW_GRAV_OBSTACLES) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7970 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7971 if((horz & 0xf) == DW_GRAV_LEFT) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7972 newx += rect.x; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7973 else if((horz & 0xf) == DW_GRAV_RIGHT) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7974 newx -= _dw_screen_width() - (rect.x + rect.width); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7975 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7976 if(vert & DW_GRAV_OBSTACLES) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7977 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7978 if((vert & 0xf) == DW_GRAV_TOP) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7979 newy += rect.y; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7980 else if((vert & 0xf) == DW_GRAV_BOTTOM) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7981 newy -= _dw_screen_height() - (rect.y + rect.height); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7982 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7983 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7984 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7985 /* Finally move the window into place */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7986 gtk_window_move(GTK_WINDOW(handle), newx, newy); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7987 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7988 else if((window = gtk_widget_get_window(handle))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7989 gdk_window_move(window, x, y); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7990 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7991 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7992 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7993 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7994 * Sets the position and size of a given window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7995 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7996 * handle: Window (widget) handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7997 * x: X location from the bottom left. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7998 * y: Y location from the bottom left. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7999 * width: Width of the widget. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8000 * height: Height of the widget. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8001 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8002 void dw_window_set_pos_size(HWND handle, long x, long y, unsigned long width, unsigned long height) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8003 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8004 dw_window_set_size(handle, width, height); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8005 dw_window_set_pos(handle, x, y); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8006 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8007 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8008 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8009 * Gets the position and size of a given window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8010 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8011 * handle: Window (widget) handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8012 * x: X location from the bottom left. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8013 * y: Y location from the bottom left. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8014 * width: Width of the widget. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8015 * height: Height of the widget. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8016 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8017 void dw_window_get_pos_size(HWND handle, long *x, long *y, ULONG *width, ULONG *height) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8018 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8019 gint gx = 0, gy = 0, gwidth = 0, gheight = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8020 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8021 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8022 GdkWindow *window; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8023 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8024 /* Can only query if the window is realized */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8025 if(handle && (window = gtk_widget_get_window(handle))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8026 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8027 /* If it is a toplevel window */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8028 if(GTK_IS_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8029 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8030 if(gtk_widget_get_mapped(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8031 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8032 GdkRectangle frame; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8033 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8034 /* Calculate the border rectangle */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8035 gdk_window_get_frame_extents(window, &frame); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8036 gx = frame.x; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8037 gy = frame.y; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8038 gwidth = frame.width; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8039 gheight = frame.height; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8040 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8041 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8042 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8043 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8044 /* Get an individual widget coordinates */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8045 gdk_window_get_geometry(window, &gx, &gy, &gwidth, &gheight); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8046 gdk_window_get_root_origin(window, &gx, &gy); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8047 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8048 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8049 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8050 /* Fill in the requested fields */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8051 if(x) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8052 *x = gx; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8053 if(y) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8054 *y = gy; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8055 if(width) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8056 *width = gwidth; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8057 if(height) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8058 *height = gheight; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8059 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8060 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8061 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8062 * Sets the style of a given window (widget). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8063 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8064 * handle: Window (widget) handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8065 * width: New width in pixels. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8066 * height: New height in pixels. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8067 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8068 void dw_window_set_style(HWND handle, unsigned long style, unsigned long mask) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8069 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8070 GtkWidget *handle2 = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8071 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8072 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8073 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8074 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8075 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8076 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8077 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8078 else if(GTK_IS_FRAME(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8079 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8080 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_label"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8081 if(tmp && GTK_IS_LABEL(tmp)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8082 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8083 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8084 else if(GTK_IS_BUTTON(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8085 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8086 if(mask & DW_BS_NOBORDER) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8087 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8088 if(style & DW_BS_NOBORDER) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8089 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8090 gtk_button_set_relief((GtkButton *)handle, GTK_RELIEF_NONE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8091 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8092 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8093 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8094 gtk_button_set_relief((GtkButton *)handle, GTK_RELIEF_NORMAL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8095 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8096 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8097 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8098 if ( GTK_IS_LABEL(handle2) ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8099 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8100 gfloat x=DW_LEFT, y=DW_CENTER; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8101 /* horizontal... */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8102 if ( style & DW_DT_CENTER ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8103 x = DW_CENTER; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8104 if ( style & DW_DT_RIGHT ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8105 x = DW_RIGHT; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8106 if ( style & DW_DT_LEFT ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8107 x = DW_LEFT; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8108 /* vertical... */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8109 if ( style & DW_DT_VCENTER ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8110 y = DW_CENTER; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8111 if ( style & DW_DT_TOP ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8112 y = DW_TOP; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8113 if ( style & DW_DT_BOTTOM ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8114 y = DW_BOTTOM; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8115 gtk_label_set_xalign(GTK_LABEL(handle2), x); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8116 gtk_label_set_yalign(GTK_LABEL(handle2), y); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8117 if ( style & DW_DT_WORDBREAK ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8118 gtk_label_set_line_wrap( GTK_LABEL(handle), TRUE ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8119 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8120 if ( GTK_IS_CHECK_MENU_ITEM(handle2) && (mask & (DW_MIS_CHECKED | DW_MIS_UNCHECKED)) ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8121 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8122 int check = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8123 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8124 if ( style & DW_MIS_CHECKED ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8125 check = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8126 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8127 _dw_ignore_click = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8128 if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(handle2)) != check) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8129 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(handle2), check); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8130 _dw_ignore_click = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8131 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8132 if ( (GTK_IS_CHECK_MENU_ITEM(handle2) || GTK_IS_MENU_ITEM(handle2)) && (mask & (DW_MIS_ENABLED | DW_MIS_DISABLED) )) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8133 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8134 _dw_ignore_click = 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8135 if ( style & DW_MIS_ENABLED ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8136 gtk_widget_set_sensitive( handle2, TRUE ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8137 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8138 gtk_widget_set_sensitive( handle2, FALSE ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8139 _dw_ignore_click = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8140 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8141 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8142 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8143 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8144 * Adds a new page to specified notebook. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8145 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8146 * handle: Window (widget) handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8147 * flags: Any additional page creation flags. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8148 * front: If TRUE page is added at the beginning. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8149 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8150 unsigned long dw_notebook_page_new(HWND handle, unsigned long flags, int front) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8151 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8152 int z; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8153 GtkWidget **pagearray; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8154 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8155 pagearray = (GtkWidget **)g_object_get_data(G_OBJECT(handle), "_dw_pagearray"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8156 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8157 if(pagearray) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8158 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8159 for(z=0;z<256;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8160 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8161 if(!pagearray[z]) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8162 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8163 char text[101] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8164 int num = z; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8165 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8166 if(front) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8167 num |= 1 << 16; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8168 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8169 snprintf(text, 100, "_dw_page%d", z); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8170 /* Save the real id and the creation flags */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8171 g_object_set_data(G_OBJECT(handle), text, GINT_TO_POINTER(num)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8172 return z; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8173 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8174 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8175 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8176 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8177 /* Hopefully this won't happen. */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8178 return 256; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8179 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8180 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8181 /* Return the physical page id from the logical page id */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8182 int _get_physical_page(HWND handle, unsigned long pageid) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8183 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8184 int z; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8185 GtkWidget *thispage, **pagearray = g_object_get_data(G_OBJECT(handle), "_dw_pagearray"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8186 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8187 if(pagearray) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8188 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8189 for(z=0;z<256;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8190 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8191 if((thispage = gtk_notebook_get_nth_page(GTK_NOTEBOOK(handle), z))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8192 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8193 if(thispage == pagearray[pageid]) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8194 return z; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8195 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8196 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8197 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8198 return 256; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8199 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8200 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8201 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8202 * Remove a page from a notebook. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8203 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8204 * handle: Handle to the notebook widget. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8205 * pageid: ID of the page to be destroyed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8206 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8207 void dw_notebook_page_destroy(HWND handle, unsigned int pageid) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8208 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8209 int realpage; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8210 GtkWidget **pagearray; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8211 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8212 realpage = _get_physical_page(handle, pageid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8213 if(realpage > -1 && realpage < 256) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8214 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8215 gtk_notebook_remove_page(GTK_NOTEBOOK(handle), realpage); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8216 if((pagearray = g_object_get_data(G_OBJECT(handle), "_dw_pagearray"))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8217 pagearray[pageid] = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8218 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8219 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8220 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8221 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8222 * Queries the currently visible page ID. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8223 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8224 * handle: Handle to the notebook widget. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8225 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8226 unsigned long dw_notebook_page_get(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8227 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8228 int retval, phys; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8229 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8230 phys = gtk_notebook_get_current_page(GTK_NOTEBOOK(handle)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8231 retval = _get_logical_page(handle, phys); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8232 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8233 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8234 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8235 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8236 * Sets the currently visibale page ID. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8237 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8238 * handle: Handle to the notebook widget. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8239 * pageid: ID of the page to be made visible. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8240 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8241 void dw_notebook_page_set(HWND handle, unsigned int pageid) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8242 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8243 int realpage; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8244 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8245 realpage = _get_physical_page(handle, pageid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8246 if(realpage > -1 && realpage < 256) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8247 gtk_notebook_set_current_page(GTK_NOTEBOOK(handle), pageid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8248 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8249 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8250 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8251 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8252 * Sets the text on the specified notebook tab. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8253 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8254 * handle: Notebook handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8255 * pageid: Page ID of the tab to set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8256 * text: Pointer to the text to set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8257 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8258 void dw_notebook_page_set_text(HWND handle, unsigned long pageid, const char *text) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8259 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8260 GtkWidget *child; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8261 int realpage; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8262 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8263 realpage = _get_physical_page(handle, pageid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8264 if(realpage < 0 || realpage > 255) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8265 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8266 char ptext[101] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8267 int num; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8268 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8269 snprintf(ptext, 100, "_dw_page%d", (int)pageid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8270 num = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), ptext)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8271 realpage = 0xFF & num; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8272 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8273 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8274 if(realpage > -1 && realpage < 256) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8275 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8276 child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(handle), realpage); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8277 if(child) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8278 gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(handle), child, text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8279 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8280 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8281 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8282 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8283 * Sets the text on the specified notebook tab status area. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8284 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8285 * handle: Notebook handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8286 * pageid: Page ID of the tab to set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8287 * text: Pointer to the text to set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8288 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8289 void dw_notebook_page_set_status_text(HWND handle, unsigned long pageid, const char *text) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8290 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8291 /* TODO (if possible) */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8292 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8293 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8294 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8295 * Packs the specified box into the notebook page. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8296 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8297 * handle: Handle to the notebook to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8298 * pageid: Page ID in the notebook which is being packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8299 * page: Box handle to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8300 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8301 void dw_notebook_pack(HWND handle, unsigned long pageid, HWND page) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8302 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8303 GtkWidget *label, *child, *oldlabel, **pagearray; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8304 const gchar *text = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8305 int num, z, realpage = -1, pad; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8306 char ptext[101] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8307 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8308 snprintf(ptext, 100, "_dw_page%d", (int)pageid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8309 num = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), ptext)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8310 g_object_set_data(G_OBJECT(handle), ptext, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8311 pagearray = (GtkWidget **)g_object_get_data(G_OBJECT(handle), "_dw_pagearray"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8312 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8313 if(!pagearray) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8314 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8315 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8316 /* The page already exists... so get it's current page */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8317 if(pagearray[pageid]) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8318 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8319 for(z=0;z<256;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8320 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8321 child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(handle), z); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8322 if(child == pagearray[pageid]) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8323 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8324 oldlabel = gtk_notebook_get_tab_label(GTK_NOTEBOOK(handle), child); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8325 if(oldlabel) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8326 text = gtk_label_get_text(GTK_LABEL(oldlabel)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8327 gtk_notebook_remove_page(GTK_NOTEBOOK(handle), z); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8328 realpage = z; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8329 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8330 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8331 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8332 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8333 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8334 pagearray[pageid] = page; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8335 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8336 label = gtk_label_new(text ? text : ""); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8337 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8338 if(GTK_IS_GRID(page)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8339 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8340 pad = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(page), "_dw_boxpad")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8341 gtk_container_set_border_width(GTK_CONTAINER(page), pad); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8342 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8343 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8344 if(realpage != -1) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8345 gtk_notebook_insert_page(GTK_NOTEBOOK(handle), page, label, realpage); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8346 else if(num & ~(0xFF)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8347 gtk_notebook_insert_page(GTK_NOTEBOOK(handle), page, label, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8348 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8349 gtk_notebook_insert_page(GTK_NOTEBOOK(handle), page, label, 256); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8350 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8351 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8352 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8353 * Appends the specified text to the listbox's (or combobox) entry list. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8354 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8355 * handle: Handle to the listbox to be appended to. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8356 * text: Text to append into listbox. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8357 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8358 void dw_listbox_append(HWND handle, const char *text) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8359 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8360 dw_listbox_insert(handle, text, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8361 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8362 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8363 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8364 * Inserts the specified text int the listbox's (or combobox) entry list at the |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8365 * position indicated. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8366 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8367 * handle: Handle to the listbox to be appended to. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8368 * text: Text to insert into listbox. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8369 * pos: 0-based index into listbox. -1 will append |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8370 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8371 void dw_listbox_insert(HWND handle, const char *text, int pos) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8372 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8373 GtkWidget *handle2 = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8374 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8375 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8376 /* Get the inner handle for scrolled controls */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8377 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8378 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8379 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8380 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8381 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8382 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8383 if(handle2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8384 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8385 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8386 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8387 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8388 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8389 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8390 else if(GTK_IS_COMBO_BOX(handle2)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8391 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8392 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8393 if(!store) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8394 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8395 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8396 if(pos < 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8397 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8398 /* Insert an entry at the end */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8399 gtk_list_store_append(store, &iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8400 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8401 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8402 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8403 /* Insert at position */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8404 gtk_list_store_insert(store, &iter, pos); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8405 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8406 gtk_list_store_set (store, &iter, 0, text, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8407 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8408 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8409 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8410 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8411 * Appends the specified text items to the listbox's (or combobox) entry list. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8412 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8413 * handle: Handle to the listbox to be appended to. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8414 * text: Text strings to append into listbox. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8415 * count: Number of text strings to append |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8416 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8417 void dw_listbox_list_append(HWND handle, char **text, int count) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8418 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8419 GtkWidget *handle2 = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8420 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8421 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8422 /* Get the inner handle for scrolled controls */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8423 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8424 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8425 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8426 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8427 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8428 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8429 if(handle2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8430 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8431 int z; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8432 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8433 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8434 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8435 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8436 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8437 else if(GTK_IS_COMBO_BOX(handle2)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8438 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8439 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8440 if(!store) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8441 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8442 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8443 /* Insert entries at the end */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8444 for(z=0;z<count;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8445 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8446 gtk_list_store_append(store, &iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8447 gtk_list_store_set (store, &iter, 0, text[z], -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8448 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8449 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8450 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8451 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8452 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8453 * Clears the listbox's (or combobox) list of all entries. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8454 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8455 * handle: Handle to the listbox to be cleared. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8456 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8457 void dw_listbox_clear(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8458 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8459 GtkWidget *handle2 = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8460 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8461 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8462 /* Get the inner handle for scrolled controls */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8463 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8464 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8465 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8466 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8467 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8468 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8469 if(handle2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8470 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8471 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8472 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8473 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8474 else if(GTK_IS_COMBO_BOX(handle2)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8475 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8476 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8477 if(!store) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8478 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8479 /* Clear the list */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8480 gtk_list_store_clear(store); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8481 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8482 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8483 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8484 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8485 * Returns the listbox's item count. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8486 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8487 * handle: Handle to the listbox to be counted |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8488 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8489 int dw_listbox_count(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8490 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8491 GtkWidget *handle2 = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8492 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8493 int retval = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8494 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8495 /* Get the inner handle for scrolled controls */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8496 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8497 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8498 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8499 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8500 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8501 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8502 if(handle2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8503 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8504 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8505 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8506 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8507 else if(GTK_IS_COMBO_BOX(handle2)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8508 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8509 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8510 if(store) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8511 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8512 /* Get the number of children at the top level */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8513 retval = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8514 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8515 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8516 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8517 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8518 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8519 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8520 * Sets the topmost item in the viewport. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8521 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8522 * handle: Handle to the listbox to be cleared. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8523 * top: Index to the top item. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8524 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8525 void dw_listbox_set_top(HWND handle, int top) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8526 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8527 GtkWidget *handle2 = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8528 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8529 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8530 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8531 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8532 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8533 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8534 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8535 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8536 if(handle2 && GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8537 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8538 GtkAdjustment *adjust = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(handle)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8539 GtkListStore *store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8540 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8541 if(store && adjust) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8542 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8543 /* Get the number of children at the top level */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8544 gint rowcount = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8545 gdouble pagesize = gtk_adjustment_get_page_size(adjust); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8546 gdouble upper = gtk_adjustment_get_upper(adjust) - pagesize; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8547 gdouble lower = gtk_adjustment_get_lower(adjust); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8548 gdouble change; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8549 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8550 /* Safety check */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8551 if(rowcount < 2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8552 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8553 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8554 /* Verify the range */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8555 rowcount--; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8556 if(top > rowcount) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8557 top = rowcount; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8558 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8559 change = ((gdouble)top/(gdouble)rowcount) * (upper - lower); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8560 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8561 gtk_adjustment_set_value(adjust, change + lower); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8562 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8563 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8564 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8565 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8566 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8567 * Copies the given index item's text into buffer. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8568 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8569 * handle: Handle to the listbox to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8570 * index: Index into the list to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8571 * buffer: Buffer where text will be copied. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8572 * length: Length of the buffer (including NULL). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8573 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8574 void dw_listbox_get_text(HWND handle, unsigned int index, char *buffer, unsigned int length) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8575 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8576 GtkWidget *handle2 = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8577 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8578 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8579 /* Get the inner handle for scrolled controls */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8580 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8581 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8582 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8583 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8584 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8585 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8586 if(handle2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8587 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8588 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8589 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8590 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8591 else if(GTK_IS_COMBO_BOX(handle2)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8592 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8593 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8594 if(store && index < gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8595 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8596 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8597 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8598 /* Get the nth child at the top level */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8599 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8600 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8601 /* Get the text */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8602 gchar *text; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8603 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, _DW_DATA_TYPE_STRING, &text, -1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8604 if(text) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8605 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8606 strncpy(buffer, text, length); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8607 g_free(text); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8608 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8609 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8610 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8611 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8612 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8613 buffer[0] = '\0'; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8614 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8615 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8616 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8617 * Sets the text of a given listbox entry. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8618 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8619 * handle: Handle to the listbox to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8620 * index: Index into the list to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8621 * buffer: Buffer where text will be copied. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8622 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8623 void dw_listbox_set_text(HWND handle, unsigned int index, const char *buffer) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8624 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8625 GtkWidget *handle2 = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8626 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8627 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8628 /* Get the inner handle for scrolled controls */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8629 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8630 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8631 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8632 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8633 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8634 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8635 if(handle2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8636 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8637 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8638 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8639 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8640 else if(GTK_IS_COMBO_BOX(handle2)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8641 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8642 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8643 if(store && index < gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8644 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8645 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8646 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8647 /* Get the nth child at the top level */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8648 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8649 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8650 /* Update the text */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8651 gtk_list_store_set(store, &iter, buffer); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8652 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8653 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8654 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8655 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8656 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8657 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8658 * Returns the index to the current selected item or -1 when done. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8659 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8660 * handle: Handle to the listbox to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8661 * where: Either the previous return or -1 to restart. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8662 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8663 int dw_listbox_selected_multi(HWND handle, int where) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8664 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8665 GtkWidget *handle2; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8666 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8667 int retval = DW_LIT_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8668 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8669 handle2 = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8670 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8671 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8672 if(handle2 && GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8673 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8674 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8675 if(store) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8676 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8677 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8678 GList *list = gtk_tree_selection_get_selected_rows(sel, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8679 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8680 if(list) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8681 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8682 int counter = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8683 GtkTreePath *path = g_list_nth_data(list, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8684 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8685 while(path) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8686 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8687 gint *indices = gtk_tree_path_get_indices(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8688 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8689 if(indices && indices[0] > where) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8690 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8691 retval = indices[0]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8692 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8693 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8694 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8695 counter++; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8696 path = g_list_nth_data(list, counter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8697 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8698 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8699 g_list_foreach(list, (GFunc) gtk_tree_path_free, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8700 g_list_free(list); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8701 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8702 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8703 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8704 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8705 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8706 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8707 * Returns the index to the item in the list currently selected. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8708 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8709 * handle: Handle to the listbox to be queried. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8710 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8711 int dw_listbox_selected(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8712 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8713 GtkWidget *handle2 = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8714 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8715 unsigned int retval = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8716 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8717 /* Get the inner handle for scrolled controls */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8718 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8719 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8720 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8721 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8722 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8723 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8724 if(handle2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8725 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8726 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8727 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8728 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8729 else if(GTK_IS_COMBO_BOX(handle2)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8730 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8731 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8732 if(store) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8733 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8734 if(GTK_IS_TREE_VIEW(handle2)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8735 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8736 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8737 GList *list = gtk_tree_selection_get_selected_rows(sel, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8738 if(list) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8739 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8740 GtkTreePath *path = g_list_nth_data(list, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8741 gint *indices = gtk_tree_path_get_indices(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8742 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8743 if(indices) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8744 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8745 retval = indices[0]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8746 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8747 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8748 g_list_foreach(list, (GFunc) gtk_tree_path_free, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8749 g_list_free(list); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8750 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8751 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8752 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8753 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8754 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8755 GtkTreePath *path; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8756 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8757 if(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(handle2), &iter)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8758 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8759 path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8760 if(path) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8761 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8762 gint *indices = gtk_tree_path_get_indices(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8763 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8764 if(indices) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8765 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8766 retval = indices[0]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8767 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8768 gtk_tree_path_free(path); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8769 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8770 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8771 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8772 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8773 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8774 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8775 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8776 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8777 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8778 * Sets the selection state of a given index. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8779 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8780 * handle: Handle to the listbox to be set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8781 * index: Item index. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8782 * state: TRUE if selected FALSE if unselected. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8783 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8784 void dw_listbox_select(HWND handle, int index, int state) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8785 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8786 GtkWidget *handle2 = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8787 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8788 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8789 /* Get the inner handle for scrolled controls */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8790 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8791 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8792 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8793 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8794 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8795 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8796 if(handle2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8797 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8798 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8799 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8800 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8801 else if(GTK_IS_COMBO_BOX(handle2)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8802 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8803 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8804 if(store && index < gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8805 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8806 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8807 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8808 /* Get the nth child at the top level */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8809 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8810 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8811 if(GTK_IS_COMBO_BOX(handle2)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8812 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8813 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(handle2), &iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8814 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8815 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8816 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8817 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8818 if(state) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8819 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8820 /* Select the item */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8821 gtk_tree_selection_select_iter(sel, &iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8822 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8823 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8824 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8825 /* Deselect the item */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8826 gtk_tree_selection_unselect_iter(sel, &iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8827 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8828 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8829 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8830 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8831 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8832 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8833 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8834 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8835 * Deletes the item with given index from the list. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8836 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8837 * handle: Handle to the listbox to be set. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8838 * index: Item index. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8839 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8840 void dw_listbox_delete(HWND handle, int index) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8841 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8842 GtkWidget *handle2 = handle; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8843 GtkListStore *store = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8844 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8845 /* Get the inner handle for scrolled controls */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8846 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8847 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8848 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8849 if(tmp) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8850 handle2 = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8851 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8852 if(handle2) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8853 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8854 /* Make sure it is the correct tree type */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8855 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8856 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8857 else if(GTK_IS_COMBO_BOX(handle2)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8858 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8859 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8860 if(store) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8861 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8862 GtkTreeIter iter; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8863 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8864 /* Get the nth child at the top level */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8865 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8866 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8867 gtk_list_store_remove(store, &iter); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8868 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8869 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8870 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8871 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8872 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8873 /* Function to do delayed positioning */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8874 gboolean _splitbar_set_percent(gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8875 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8876 GtkWidget *widget = data; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8877 float *percent = (float *)g_object_get_data(G_OBJECT(widget), "_dw_percent"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8878 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8879 if(percent) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8880 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8881 GtkAllocation alloc; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8882 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8883 gtk_widget_get_allocation(widget, &alloc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8884 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8885 if(gtk_orientable_get_orientation(GTK_ORIENTABLE(widget)) == GTK_ORIENTATION_HORIZONTAL) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8886 gtk_paned_set_position(GTK_PANED(widget), (int)(alloc.width * (*percent / 100.0))); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8887 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8888 gtk_paned_set_position(GTK_PANED(widget), (int)(alloc.height * (*percent / 100.0))); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8889 g_object_set_data(G_OBJECT(widget), "_dw_percent", NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8890 free(percent); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8891 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8892 return FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8893 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8894 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8895 /* Reposition the bar according to the percentage */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8896 static gint _splitbar_size_allocate(GtkWidget *widget, GtkAllocation *event, gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8897 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8898 float *percent = (float *)g_object_get_data(G_OBJECT(widget), "_dw_percent"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8899 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8900 /* Prevent infinite recursion ;) */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8901 if(!percent || event->width < 20 || event->height < 20) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8902 return FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8903 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8904 g_idle_add(_splitbar_set_percent, widget); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8905 return FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8906 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8907 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8908 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8909 * Creates a splitbar window (widget) with given parameters. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8910 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8911 * type: Value can be DW_VERT or DW_HORZ. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8912 * topleft: Handle to the window to be top or left. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8913 * bottomright: Handle to the window to be bottom or right. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8914 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8915 * A handle to a splitbar window or NULL on failure. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8916 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8917 HWND dw_splitbar_new(int type, HWND topleft, HWND bottomright, unsigned long id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8918 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8919 GtkWidget *tmp = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8920 float *percent = malloc(sizeof(float)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8921 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8922 tmp = gtk_paned_new(type == DW_HORZ ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8923 gtk_paned_pack1(GTK_PANED(tmp), topleft, TRUE, FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8924 gtk_paned_pack2(GTK_PANED(tmp), bottomright, TRUE, FALSE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8925 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8926 *percent = 50.0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8927 g_object_set_data(G_OBJECT(tmp), "_dw_percent", (gpointer)percent); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8928 g_signal_connect(G_OBJECT(tmp), "size-allocate", G_CALLBACK(_splitbar_size_allocate), NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8929 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8930 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8931 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8932 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8933 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8934 * Sets the position of a splitbar (pecentage). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8935 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8936 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8937 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8938 void dw_splitbar_set(HWND handle, float percent) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8939 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8940 float *mypercent = (float *)dw_window_get_data(handle, "_dw_percent"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8941 int size = 0, position; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8942 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8943 if(gtk_orientable_get_orientation(GTK_ORIENTABLE(handle)) == GTK_ORIENTATION_HORIZONTAL) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8944 size = gtk_widget_get_allocated_width(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8945 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8946 size = gtk_widget_get_allocated_height(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8947 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8948 if(mypercent) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8949 *mypercent = percent; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8950 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8951 if(size > 10) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8952 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8953 position = (int)((float)size * (percent / 100.0)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8954 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8955 gtk_paned_set_position(GTK_PANED(handle), position); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8956 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8957 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8958 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8959 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8960 * Gets the position of a splitbar (pecentage). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8961 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8962 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8963 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8964 float dw_splitbar_get(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8965 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8966 float *percent = (float *)dw_window_get_data(handle, "_dw_percent"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8967 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8968 if(percent) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8969 return *percent; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8970 return 0.0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8971 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8972 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8973 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8974 * Creates a calendar window (widget) with given parameters. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8975 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8976 * id: Unique identifier for calendar widget |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8977 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8978 * A handle to a calendar window or NULL on failure. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8979 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8980 HWND dw_calendar_new(unsigned long id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8981 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8982 GtkWidget *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8983 GtkCalendarDisplayOptions flags; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8984 time_t now; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8985 struct tm *tmdata; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8986 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8987 tmp = gtk_calendar_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8988 gtk_widget_show(tmp); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8989 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8990 /* select today */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8991 flags = GTK_CALENDAR_SHOW_HEADING|GTK_CALENDAR_SHOW_DAY_NAMES; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8992 gtk_calendar_set_display_options( GTK_CALENDAR(tmp), flags ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8993 now = time( NULL ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8994 tmdata = localtime( & now ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8995 gtk_calendar_select_month( GTK_CALENDAR(tmp), tmdata->tm_mon, 1900+tmdata->tm_year ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8996 gtk_calendar_select_day( GTK_CALENDAR(tmp), tmdata->tm_mday ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8997 return tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8998 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8999 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9000 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9001 * Sets the current date of a calendar |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9002 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9003 * handle: The handle to the calendar returned by dw_calendar_new(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9004 * year... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9005 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9006 void dw_calendar_set_date(HWND handle, unsigned int year, unsigned int month, unsigned int day) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9007 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9008 if(GTK_IS_CALENDAR(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9009 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9010 gtk_calendar_select_month(GTK_CALENDAR(handle),month-1,year); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9011 gtk_calendar_select_day(GTK_CALENDAR(handle), day); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9012 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9013 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9014 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9015 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9016 * Gets the position of a splitbar (pecentage). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9017 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9018 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9019 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9020 void dw_calendar_get_date(HWND handle, unsigned int *year, unsigned int *month, unsigned int *day) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9021 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9022 if(GTK_IS_CALENDAR(handle)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9023 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9024 gtk_calendar_get_date(GTK_CALENDAR(handle),year,month,day); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9025 *month = *month + 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9026 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9027 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9028 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9029 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9030 * Sets the current focus item for a window/dialog. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9031 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9032 * handle: Handle to the dialog item to be focused. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9033 * Remarks: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9034 * This is for use after showing the window/dialog. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9035 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9036 void API dw_window_set_focus(HWND handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9037 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9038 if(!handle) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9039 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9040 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9041 gtk_widget_grab_focus(handle); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9042 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9043 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9044 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9045 * Sets the default focus item for a window/dialog. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9046 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9047 * window: Toplevel window or dialog. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9048 * defaultitem: Handle to the dialog item to be default. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9049 * Remarks: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9050 * This is for use before showing the window/dialog. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9051 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9052 void dw_window_default(HWND window, HWND defaultitem) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9053 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9054 if(!window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9055 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9056 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9057 g_object_set_data(G_OBJECT(window), "_dw_defaultitem", (gpointer)defaultitem); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9058 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9059 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9060 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9061 * Sets window to click the default dialog item when an ENTER is pressed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9062 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9063 * window: Window (widget) to look for the ENTER press. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9064 * next: Window (widget) to move to next (or click) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9065 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9066 void dw_window_click_default(HWND window, HWND next) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9067 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9068 if(!window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9069 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9070 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9071 g_signal_connect(G_OBJECT(window), "key_press_event", G_CALLBACK(_default_key_press_event), next); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9072 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9073 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9074 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9075 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9076 * Creates a new system notification if possible. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9077 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9078 * title: The short title of the notification. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9079 * imagepath: Path to an image to display or NULL if none. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9080 * description: A longer description of the notification, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9081 * or NULL if none is necessary. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9082 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9083 * A handle to the notification which can be used to attach a "clicked" event if desired, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9084 * or NULL if it fails or notifications are not supported by the system. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9085 * Remarks: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9086 * This will create a system notification that will show in the notifaction panel |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9087 * on supported systems, which may be clicked to perform another task. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9088 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9089 HWND dw_notification_new(const char *title, const char *imagepath, const char *description, ...) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9090 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9091 GNotification *notification = g_notification_new(title); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9092 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9093 if(notification) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9094 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9095 if(description) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9096 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9097 va_list args; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9098 char outbuf[1025] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9099 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9100 va_start(args, description); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9101 vsnprintf(outbuf, 1024, description, args); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9102 va_end(args); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9103 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9104 g_notification_set_body(notification, outbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9105 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9106 if(imagepath) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9107 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9108 GFile *file = g_file_new_for_path(imagepath); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9109 GBytes *bytes = g_file_load_bytes(file, NULL, NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9110 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9111 if(bytes) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9112 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9113 GIcon *icon = g_bytes_icon_new(bytes); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9114 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9115 if(icon) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9116 g_notification_set_icon(notification, G_ICON(icon)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9117 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9118 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9119 g_notification_set_default_action_and_target(notification, "app.notification", "t", |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9120 (guint64)DW_POINTER_TO_ULONGLONG(notification)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9121 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9122 return (HWND)notification; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9123 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9124 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9125 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9126 * Sends a notification created by dw_notification_new() after attaching signal handler. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9127 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9128 * notification: The handle to the notification returned by dw_notification_new(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9129 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9130 * DW_ERROR_NONE on success, DW_ERROR_UNKNOWN on error or not supported. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9131 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9132 int dw_notification_send(HWND notification) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9133 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9134 if(notification) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9135 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9136 char id[101] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9137 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9138 /* Generate a unique ID based on the notification handle, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9139 * so we can use it to remove the notification in dw_window_destroy(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9140 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9141 snprintf(id, 100, "dw-notification-%llu", DW_POINTER_TO_ULONGLONG(notification)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9142 g_application_send_notification(_DWApp, id, (GNotification *)notification); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9143 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9144 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9145 return DW_ERROR_UNKNOWN; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9146 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9147 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9148 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9149 * Returns some information about the current operating environment. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9150 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9151 * env: Pointer to a DWEnv struct. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9152 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9153 void dw_environment_query(DWEnv *env) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9154 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9155 struct utsname name; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9156 char tempbuf[_DW_ENV_STRING_SIZE] = { 0 }, *dot; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9157 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9158 uname(&name); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9159 memset(env, '\0', sizeof(DWEnv)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9160 strncpy(env->osName, name.sysname, sizeof(env->osName)-1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9161 strncpy(tempbuf, name.release, sizeof(tempbuf)-1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9162 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9163 strncpy(env->buildDate, __DATE__, sizeof(env->buildDate)-1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9164 strncpy(env->buildTime, __TIME__, sizeof(env->buildTime)-1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9165 #ifdef USE_WEBKIT |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9166 strncpy(env->htmlEngine, "WEBKIT2", sizeof(env->htmlEngine)-1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9167 #else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9168 strncpy(env->htmlEngine, "N/A", sizeof(env->htmlEngine)-1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9169 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9170 env->DWMajorVersion = DW_MAJOR_VERSION; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9171 env->DWMinorVersion = DW_MINOR_VERSION; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9172 #ifdef VER_REV |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9173 env->DWSubVersion = VER_REV; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9174 #else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9175 env->DWSubVersion = DW_SUB_VERSION; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9176 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9177 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9178 if((dot = strchr(tempbuf, '.')) != NULL) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9179 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9180 *dot = '\0'; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9181 env->MajorVersion = atoi(tempbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9182 env->MinorVersion = atoi(&dot[1]); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9183 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9184 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9185 env->MajorVersion = atoi(tempbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9186 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9187 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9188 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9189 * Opens a file dialog and queries user selection. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9190 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9191 * title: Title bar text for dialog. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9192 * defpath: The default path of the open dialog. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9193 * ext: Default file extention. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9194 * flags: DW_FILE_OPEN or DW_FILE_SAVE or DW_DIRECTORY_OPEN |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9195 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9196 * NULL on error. A malloced buffer containing |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9197 * the file path on success. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9198 * |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9199 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9200 char *dw_file_browse(const char *title, const char *defpath, const char *ext, int flags) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9201 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9202 GtkWidget *filew; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9203 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9204 GtkFileChooserAction action; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9205 GtkFileFilter *filter1 = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9206 GtkFileFilter *filter2 = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9207 gchar *button; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9208 char *filename = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9209 char buf[1000]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9210 char mypath[PATH_MAX+1]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9211 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9212 switch (flags ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9213 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9214 case DW_DIRECTORY_OPEN: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9215 action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9216 button = _("_Open"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9217 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9218 case DW_FILE_OPEN: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9219 action = GTK_FILE_CHOOSER_ACTION_OPEN; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9220 button = _("_Open"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9221 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9222 case DW_FILE_SAVE: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9223 action = GTK_FILE_CHOOSER_ACTION_SAVE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9224 button = _("_Save"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9225 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9226 default: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9227 dw_messagebox( "Coding error", DW_MB_OK|DW_MB_ERROR, "dw_file_browse() flags argument invalid."); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9228 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9229 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9230 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9231 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9232 filew = gtk_file_chooser_dialog_new ( title, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9233 NULL, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9234 action, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9235 _("_Cancel"), GTK_RESPONSE_CANCEL, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9236 button, GTK_RESPONSE_ACCEPT, |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9237 NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9238 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9239 if ( flags == DW_FILE_SAVE ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9240 gtk_file_chooser_set_do_overwrite_confirmation( GTK_FILE_CHOOSER( filew ), TRUE ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9241 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9242 if ( ext ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9243 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9244 filter1 = gtk_file_filter_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9245 sprintf( buf, "*.%s", ext ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9246 gtk_file_filter_add_pattern( filter1, (gchar *)buf ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9247 sprintf( buf, "\"%s\" files", ext ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9248 gtk_file_filter_set_name( filter1, (gchar *)buf ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9249 filter2 = gtk_file_filter_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9250 gtk_file_filter_add_pattern( filter2, (gchar *)"*" ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9251 gtk_file_filter_set_name( filter2, (gchar *)"All Files" ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9252 gtk_file_chooser_add_filter( GTK_FILE_CHOOSER( filew ), filter1 ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9253 gtk_file_chooser_add_filter( GTK_FILE_CHOOSER( filew ), filter2 ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9254 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9255 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9256 if ( defpath ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9257 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9258 struct stat buf; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9259 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9260 if ( g_path_is_absolute( defpath ) || !realpath(defpath, mypath)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9261 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9262 strcpy( mypath, defpath ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9263 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9264 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9265 /* See if the path exists */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9266 if(stat(mypath, &buf) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9267 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9268 /* If the path is a directory... set the current folder */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9269 if(buf.st_mode & S_IFDIR) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9270 gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( filew ), mypath ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9271 else if(flags == DW_FILE_SAVE) /* Otherwise set the filename */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9272 gtk_file_chooser_set_filename( GTK_FILE_CHOOSER( filew ), mypath ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9273 else if(flags == DW_FILE_OPEN) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9274 gtk_file_chooser_select_filename( GTK_FILE_CHOOSER( filew), mypath ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9275 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9276 else if(flags == DW_FILE_SAVE) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9277 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9278 if(strchr(mypath, '/')) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9279 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9280 unsigned long x = strlen(mypath) - 1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9281 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9282 /* Trim off the filename */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9283 while(x > 0 && mypath[x] != '/') |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9284 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9285 x--; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9286 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9287 if(mypath[x] == '/') |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9288 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9289 char *file = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9290 char temp[PATH_MAX+1]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9291 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9292 /* Save the original path in temp */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9293 strcpy(temp, mypath); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9294 mypath[x] = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9295 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9296 /* Check to make sure the trimmed piece is a directory */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9297 if(realpath(mypath, temp) && stat(temp, &buf) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9298 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9299 if(buf.st_mode & S_IFDIR) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9300 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9301 /* We now have it split */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9302 file = &mypath[x+1]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9303 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9304 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9305 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9306 /* Select folder... */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9307 gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(filew), temp ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9308 /* ... and file separately */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9309 if(file) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9310 gtk_file_chooser_set_current_name( GTK_FILE_CHOOSER(filew), file ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9311 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9312 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9313 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9314 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9315 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9316 if ( gtk_dialog_run( GTK_DIALOG( filew ) ) == GTK_RESPONSE_ACCEPT ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9317 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9318 filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( filew ) ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9319 /*g_free (filename);*/ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9320 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9321 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9322 gtk_widget_destroy( filew ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9323 return filename; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9324 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9325 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9326 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9327 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9328 * Execute and external program in a seperate session. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9329 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9330 * program: Program name with optional path. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9331 * type: Either DW_EXEC_CON or DW_EXEC_GUI. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9332 * params: An array of pointers to string arguements. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9333 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9334 * -1 on error. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9335 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9336 int dw_exec(const char *program, int type, char **params) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9337 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9338 int ret = -1; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9339 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9340 if((ret = fork()) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9341 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9342 int i; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9343 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9344 for (i = 3; i < 256; i++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9345 close(i); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9346 setsid(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9347 if(type == DW_EXEC_GUI) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9348 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9349 execvp(program, params); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9350 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9351 else if(type == DW_EXEC_CON) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9352 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9353 char **tmpargs; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9354 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9355 if(!params) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9356 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9357 tmpargs = malloc(sizeof(char *)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9358 tmpargs[0] = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9359 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9360 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9361 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9362 int z = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9363 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9364 while(params[z]) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9365 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9366 z++; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9367 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9368 tmpargs = malloc(sizeof(char *)*(z+3)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9369 z=0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9370 tmpargs[0] = "xterm"; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9371 tmpargs[1] = "-e"; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9372 while(params[z]) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9373 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9374 tmpargs[z+2] = params[z]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9375 z++; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9376 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9377 tmpargs[z+2] = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9378 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9379 execvp("xterm", tmpargs); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9380 free(tmpargs); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9381 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9382 /* If we got here exec failed */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9383 _exit(-1); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9384 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9385 return ret; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9386 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9387 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9388 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9389 * Loads a web browser pointed at the given URL. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9390 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9391 * url: Uniform resource locator. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9392 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9393 int dw_browse(const char *url) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9394 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9395 /* If possible load the URL/URI using gvfs... */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9396 #if GTK_CHECK_VERSION(3,22,0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9397 if(gtk_show_uri_on_window(NULL, url, GDK_CURRENT_TIME, NULL)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9398 #else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9399 if(gtk_show_uri(gdk_screen_get_default(), url, GDK_CURRENT_TIME, NULL)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9400 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9401 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9402 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9403 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9404 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9405 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9406 /* Otherwise just fall back to executing firefox... |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9407 * or the browser defined by the DW_BROWSER variable. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9408 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9409 char *execargs[3], *browser = "firefox", *tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9410 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9411 tmp = getenv( "DW_BROWSER" ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9412 if(tmp) browser = tmp; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9413 execargs[0] = browser; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9414 execargs[1] = (char *)url; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9415 execargs[2] = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9416 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9417 return dw_exec(browser, DW_EXEC_GUI, execargs); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9418 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9419 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9420 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9421 #ifdef USE_WEBKIT |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9422 /* Helper function to get the web view handle */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9423 WebKitWebView *_dw_html_web_view(GtkWidget *widget) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9424 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9425 if(widget) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9426 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9427 WebKitWebView *web_view = (WebKitWebView *)widget; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9428 if(WEBKIT_IS_WEB_VIEW(web_view)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9429 return web_view; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9430 #ifndef USE_WEBKIT2 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9431 web_view = (WebKitWebView *)g_object_get_data(G_OBJECT(widget), "_dw_web_view"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9432 if(WEBKIT_IS_WEB_VIEW(web_view)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9433 return web_view; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9434 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9435 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9436 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9437 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9438 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9439 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9440 * Causes the embedded HTML widget to take action. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9441 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9442 * handle: Handle to the window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9443 * action: One of the DW_HTML_* constants. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9444 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9445 void dw_html_action(HWND handle, int action) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9446 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9447 #ifdef USE_WEBKIT |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9448 WebKitWebView *web_view; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9449 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9450 if((web_view = _dw_html_web_view(handle))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9451 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9452 switch(action) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9453 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9454 case DW_HTML_GOBACK: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9455 webkit_web_view_go_back(web_view); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9456 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9457 case DW_HTML_GOFORWARD: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9458 webkit_web_view_go_forward(web_view); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9459 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9460 case DW_HTML_GOHOME: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9461 webkit_web_view_load_uri(web_view, DW_HOME_URL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9462 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9463 case DW_HTML_RELOAD: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9464 webkit_web_view_reload(web_view); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9465 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9466 case DW_HTML_STOP: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9467 webkit_web_view_stop_loading(web_view); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9468 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9469 case DW_HTML_PRINT: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9470 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9471 WebKitPrintOperation *operation = webkit_print_operation_new(web_view); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9472 webkit_print_operation_run_dialog(operation, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9473 g_object_unref(operation); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9474 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9475 break; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9476 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9477 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9478 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9479 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9480 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9481 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9482 * Render raw HTML code in the embedded HTML widget.. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9483 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9484 * handle: Handle to the window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9485 * string: String buffer containt HTML code to |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9486 * be rendered. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9487 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9488 * 0 on success. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9489 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9490 int dw_html_raw(HWND handle, const char *string) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9491 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9492 #ifdef USE_WEBKIT |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9493 WebKitWebView *web_view; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9494 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9495 if((web_view = _dw_html_web_view(handle))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9496 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9497 webkit_web_view_load_html(web_view, string, "file:///"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9498 gtk_widget_show(GTK_WIDGET(handle)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9499 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9500 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9501 #else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9502 return DW_ERROR_UNKNOWN; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9503 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9504 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9505 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9506 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9507 * Render file or web page in the embedded HTML widget.. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9508 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9509 * handle: Handle to the window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9510 * url: Universal Resource Locator of the web or |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9511 * file object to be rendered. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9512 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9513 * 0 on success. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9514 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9515 int dw_html_url(HWND handle, const char *url) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9516 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9517 #ifdef USE_WEBKIT |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9518 WebKitWebView *web_view; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9519 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9520 if((web_view = _dw_html_web_view(handle))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9521 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9522 webkit_web_view_load_uri(web_view, url); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9523 gtk_widget_show(GTK_WIDGET(handle)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9524 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9525 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9526 #else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9527 return DW_ERROR_UNKNOWN; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9528 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9529 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9530 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9531 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9532 * Executes the javascript contained in "script" in the HTML window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9533 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9534 * handle: Handle to the HTML window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9535 * script: Javascript code to execute. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9536 * scriptdata: Data passed to the signal handler. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9537 * Notes: A DW_SIGNAL_HTML_RESULT event will be raised with scriptdata. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9538 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9539 * DW_ERROR_NONE (0) on success. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9540 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9541 int dw_html_javascript_run(HWND handle, const char *script, void *scriptdata) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9542 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9543 #ifdef USE_WEBKIT |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9544 WebKitWebView *web_view; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9545 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9546 if((web_view = _dw_html_web_view(handle))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9547 webkit_web_view_run_javascript(web_view, script, NULL, _html_result_event, scriptdata); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9548 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9549 #else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9550 return DW_ERROR_UNKNOWN; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9551 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9552 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9553 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9554 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9555 * Create a new HTML window (widget) to be packed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9556 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9557 * id: An ID to be used with dw_window_from_id() or 0L. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9558 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9559 HWND dw_html_new(unsigned long id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9560 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9561 GtkWidget *widget = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9562 #ifdef USE_WEBKIT |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9563 WebKitWebView *web_view; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9564 WebKitSettings *settings; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9565 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9566 web_view = (WebKitWebView *)webkit_web_view_new(); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9567 settings = webkit_web_view_get_settings(web_view); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9568 /* Make sure java script is enabled */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9569 webkit_settings_set_enable_javascript(settings, TRUE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9570 webkit_web_view_set_settings(web_view, settings); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9571 widget = (GtkWidget *)web_view; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9572 gtk_widget_show(widget); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9573 #else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9574 dw_debug( "HTML widget not available; you do not have access to webkit.\n" ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9575 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9576 return widget; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9577 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9578 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9579 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9580 * Gets the contents of the default clipboard as text. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9581 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9582 * None. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9583 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9584 * Pointer to an allocated string of text or NULL if clipboard empty or contents could not |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9585 * be converted to text. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9586 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9587 char *dw_clipboard_get_text() |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9588 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9589 GtkClipboard *clipboard_object; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9590 char *ret = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9591 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9592 if((clipboard_object = gtk_clipboard_get( GDK_SELECTION_CLIPBOARD ))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9593 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9594 gchar *clipboard_contents; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9595 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9596 if((clipboard_contents = gtk_clipboard_wait_for_text( clipboard_object ))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9597 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9598 ret = strdup((char *)clipboard_contents); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9599 g_free(clipboard_contents); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9600 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9601 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9602 return ret; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9603 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9604 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9605 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9606 * Sets the contents of the default clipboard to the supplied text. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9607 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9608 * Text. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9609 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9610 void dw_clipboard_set_text(const char *str, int len) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9611 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9612 GtkClipboard *clipboard_object; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9613 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9614 if((clipboard_object = gtk_clipboard_get( GDK_SELECTION_CLIPBOARD ))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9615 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9616 gtk_clipboard_set_text( clipboard_object, str, len ); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9617 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9618 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9619 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9620 /* Internal function to create the drawable pixmap and call the function */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9621 static void _dw_draw_page(GtkPrintOperation *operation, GtkPrintContext *context, int page_nr) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9622 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9623 cairo_t *cr = gtk_print_context_get_cairo_context(context); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9624 void *drawdata = g_object_get_data(G_OBJECT(operation), "_dw_drawdata"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9625 int (*drawfunc)(HPRINT, HPIXMAP, int, void *) = g_object_get_data(G_OBJECT(operation), "_dw_drawfunc"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9626 int result = 0; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9627 HPIXMAP pixmap; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9628 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9629 if(cr && drawfunc && (pixmap = calloc(1,sizeof(struct _hpixmap)))) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9630 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9631 pixmap->image = cairo_get_group_target(cr); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9632 pixmap->handle = (HWND)operation; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9633 pixmap->width = gtk_print_context_get_width(context); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9634 pixmap->height = gtk_print_context_get_height(context); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9635 result = drawfunc((HPRINT)operation, pixmap, page_nr, drawdata); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9636 if(result) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9637 gtk_print_operation_draw_page_finish(operation); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9638 free(pixmap); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9639 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9640 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9641 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9642 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9643 * Creates a new print object. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9644 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9645 * jobname: Name of the print job to show in the queue. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9646 * flags: Flags to initially configure the print object. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9647 * pages: Number of pages to print. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9648 * drawfunc: The pointer to the function to be used as the callback. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9649 * drawdata: User data to be passed to the handler function. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9650 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9651 * A handle to the print object or NULL on failure. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9652 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9653 HPRINT API dw_print_new(const char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9654 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9655 GtkPrintOperation *op; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9656 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9657 if(!drawfunc) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9658 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9659 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9660 if((op = gtk_print_operation_new())) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9661 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9662 gtk_print_operation_set_n_pages(op, pages); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9663 gtk_print_operation_set_job_name(op, jobname ? jobname : "Dynamic Windows Print Job"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9664 g_object_set_data(G_OBJECT(op), "_dw_drawfunc", drawfunc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9665 g_object_set_data(G_OBJECT(op), "_dw_drawdata", drawdata); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9666 g_signal_connect(op, "draw_page", G_CALLBACK(_dw_draw_page), NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9667 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9668 return (HPRINT)op; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9669 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9670 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9671 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9672 * Runs the print job, causing the draw page callbacks to fire. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9673 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9674 * print: Handle to the print object returned by dw_print_new(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9675 * flags: Flags to run the print job. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9676 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9677 * DW_ERROR_UNKNOWN on error or DW_ERROR_NONE on success. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9678 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9679 int API dw_print_run(HPRINT print, unsigned long flags) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9680 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9681 GtkPrintOperationResult res; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9682 GtkPrintOperation *op = (GtkPrintOperation *)print; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9683 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9684 res = gtk_print_operation_run(op, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9685 return (res == GTK_PRINT_OPERATION_RESULT_ERROR ? DW_ERROR_UNKNOWN : DW_ERROR_NONE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9686 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9687 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9688 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9689 * Cancels the print job, typically called from a draw page callback. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9690 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9691 * print: Handle to the print object returned by dw_print_new(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9692 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9693 void API dw_print_cancel(HPRINT print) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9694 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9695 GtkPrintOperation *op = (GtkPrintOperation *)print; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9696 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9697 gtk_print_operation_cancel(op); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9698 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9699 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9700 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9701 * Returns a pointer to a static buffer which contains the |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9702 * current user directory. Or the root directory (C:\ on |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9703 * OS/2 and Windows). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9704 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9705 char *dw_user_dir(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9706 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9707 static char _user_dir[1024] = ""; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9708 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9709 if(!_user_dir[0]) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9710 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9711 char *home = getenv("HOME"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9712 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9713 if(home) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9714 strcpy(_user_dir, home); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9715 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9716 strcpy(_user_dir, "/"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9717 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9718 return _user_dir; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9719 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9720 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9721 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9722 * Returns a pointer to a static buffer which containes the |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9723 * private application data directory. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9724 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9725 char * API dw_app_dir(void) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9726 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9727 return _dw_share_path; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9728 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9729 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9730 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9731 * Sets the application ID used by this Dynamic Windows application instance. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9732 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9733 * appid: A string typically in the form: com.company.division.application |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9734 * appname: The application name used on Windows or NULL. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9735 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9736 * DW_ERROR_NONE after successfully setting the application ID. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9737 * DW_ERROR_UNKNOWN if unsupported on this system. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9738 * DW_ERROR_GENERAL if the application ID is not allowed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9739 * Remarks: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9740 * This must be called before dw_init(). If dw_init() is called first |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9741 * it will create a unique ID in the form: org.dbsoft.dwindows.application |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9742 * or if the application name cannot be detected: org.dbsoft.dwindows.pid.# |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9743 * The appname is only required on Windows. If NULL is passed the detected |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9744 * application name will be used, but a prettier name may be desired. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9745 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9746 int dw_app_id_set(const char *appid, const char *appname) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9747 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9748 #if GLIB_CHECK_VERSION(2,28,0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9749 if(g_application_id_is_valid(appid)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9750 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9751 strncpy(_dw_app_id, appid, _DW_APP_ID_SIZE); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9752 return DW_ERROR_NONE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9753 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9754 return DW_ERROR_GENERAL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9755 #else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9756 return DW_ERROR_UNKNOWN; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9757 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9758 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9759 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9760 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9761 * Call a function from the window (widget)'s context. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9762 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9763 * handle: Window handle of the widget. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9764 * function: Function pointer to be called. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9765 * data: Pointer to the data to be passed to the function. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9766 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9767 void dw_window_function(HWND handle, void *function, void *data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9768 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9769 void (* windowfunc)(void *); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9770 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9771 windowfunc = function; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9772 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9773 if(windowfunc) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9774 windowfunc(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9775 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9776 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9777 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9778 * Add a named user data item to a window handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9779 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9780 * window: Window handle of signal to be called back. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9781 * dataname: A string pointer identifying which signal to be hooked. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9782 * data: User data to be passed to the handler function. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9783 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9784 void dw_window_set_data(HWND window, const char *dataname, void *data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9785 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9786 HWND thiswindow = window; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9787 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9788 if(!window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9789 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9790 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9791 if(GTK_IS_SCROLLED_WINDOW(window)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9792 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9793 thiswindow = (HWND)g_object_get_data(G_OBJECT(window), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9794 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9795 if(thiswindow && G_IS_OBJECT(thiswindow)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9796 g_object_set_data(G_OBJECT(thiswindow), dataname, (gpointer)data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9797 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9798 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9799 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9800 * Gets a named user data item to a window handle. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9801 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9802 * window: Window handle of signal to be called back. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9803 * dataname: A string pointer identifying which signal to be hooked. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9804 * data: User data to be passed to the handler function. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9805 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9806 void *dw_window_get_data(HWND window, const char *dataname) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9807 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9808 HWND thiswindow = window; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9809 void *ret = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9810 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9811 if(!window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9812 return NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9813 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9814 if(GTK_IS_SCROLLED_WINDOW(window)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9815 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9816 thiswindow = (HWND)g_object_get_data(G_OBJECT(window), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9817 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9818 if(G_IS_OBJECT(thiswindow)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9819 ret = (void *)g_object_get_data(G_OBJECT(thiswindow), dataname); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9820 return ret; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9821 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9822 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9823 /* Internal function to get the state of the timer before firing */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9824 gboolean _dw_timer_func(gpointer data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9825 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9826 void (*sigfunc)(void *data) = NULL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9827 void *sdata; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9828 char tmpbuf[31] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9829 int *tag = data; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9830 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9831 if(tag) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9832 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9833 snprintf(tmpbuf, 30, "_dw_timer%d", *tag); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9834 sigfunc = g_object_get_data(G_OBJECT(_DWObject), tmpbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9835 snprintf(tmpbuf, 30, "_dw_timerdata%d", *tag); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9836 sdata = g_object_get_data(G_OBJECT(_DWObject), tmpbuf); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9837 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9838 if(!sigfunc) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9839 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9840 if(tag) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9841 free(tag); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9842 return FALSE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9843 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9844 sigfunc(sdata); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9845 return TRUE; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9846 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9847 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9848 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9849 * Add a callback to a timer event. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9850 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9851 * interval: Milliseconds to delay between calls. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9852 * sigfunc: The pointer to the function to be used as the callback. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9853 * data: User data to be passed to the handler function. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9854 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9855 * Timer ID for use with dw_timer_disconnect(), 0 on error. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9856 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9857 int API dw_timer_connect(int interval, void *sigfunc, void *data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9858 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9859 int *tag; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9860 char tmpbuf[31] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9861 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9862 tag = calloc(1, sizeof(int)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9863 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9864 *tag = g_timeout_add(interval, (GSourceFunc)_dw_timer_func, (gpointer)tag); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9865 snprintf(tmpbuf, 30, "_dw_timer%d", *tag); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9866 g_object_set_data(G_OBJECT(_DWObject), tmpbuf, sigfunc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9867 snprintf(tmpbuf, 30, "_dw_timerdata%d", *tag); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9868 g_object_set_data(G_OBJECT(_DWObject), tmpbuf, data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9869 return *tag; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9870 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9871 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9872 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9873 * Removes timer callback. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9874 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9875 * id: Timer ID returned by dw_timer_connect(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9876 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9877 void API dw_timer_disconnect(int id) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9878 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9879 char tmpbuf[31] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9880 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9881 snprintf(tmpbuf, 30, "_dw_timer%d", id); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9882 g_object_set_data(G_OBJECT(_DWObject), tmpbuf, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9883 snprintf(tmpbuf, 30, "_dw_timerdata%d", id); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9884 g_object_set_data(G_OBJECT(_DWObject), tmpbuf, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9885 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9886 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9887 /* Get the actual signal window handle not the user window handle |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9888 * Should mimic the code in dw_signal_connect() below. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9889 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9890 static HWND _find_signal_window(HWND window, const char *signame) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9891 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9892 HWND thiswindow = window; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9893 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9894 if(GTK_IS_SCROLLED_WINDOW(thiswindow)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9895 thiswindow = (HWND)g_object_get_data(G_OBJECT(window), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9896 else if(GTK_IS_SCALE(thiswindow) || GTK_IS_SCROLLBAR(thiswindow) || GTK_IS_SPIN_BUTTON(thiswindow)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9897 thiswindow = (GtkWidget *)g_object_get_data(G_OBJECT(thiswindow), "_dw_adjustment"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9898 else if(GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9899 thiswindow = (GtkWidget *)gtk_tree_view_get_selection(GTK_TREE_VIEW(thiswindow)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9900 return thiswindow; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9901 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9902 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9903 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9904 * Add a callback to a window event. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9905 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9906 * window: Window handle of signal to be called back. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9907 * signame: A string pointer identifying which signal to be hooked. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9908 * sigfunc: The pointer to the function to be used as the callback. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9909 * data: User data to be passed to the handler function. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9910 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9911 void dw_signal_connect(HWND window, const char *signame, void *sigfunc, void *data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9912 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9913 dw_signal_connect_data(window, signame, sigfunc, NULL, data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9914 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9915 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9916 /* Internal function to free any allocated signal data.. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9917 * and call any required function to free additional memory. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9918 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9919 static void _dw_signal_disconnect(gpointer data, GClosure *closure) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9920 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9921 if(data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9922 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9923 void **params = (void **)data; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9924 void (*discfunc)(HWND, void *) = params[1]; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9925 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9926 if(discfunc) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9927 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9928 SignalHandler work = _get_signal_handler(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9929 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9930 if(work.window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9931 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9932 discfunc(work.window, work.data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9933 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9934 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9935 free(data); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9936 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9937 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9938 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9939 #define _DW_INTERNAL_CALLBACK_PARAMS 4 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9940 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9941 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9942 * Add a callback to a window event with a closure callback. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9943 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9944 * window: Window handle of signal to be called back. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9945 * signame: A string pointer identifying which signal to be hooked. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9946 * sigfunc: The pointer to the function to be used as the callback. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9947 * discfunc: The pointer to the function called when this handler is removed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9948 * data: User data to be passed to the handler function. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9949 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9950 void dw_signal_connect_data(HWND window, const char *signame, void *sigfunc, void *discfunc, void *data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9951 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9952 void *thisfunc = _findsigfunc(signame); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9953 char *thisname = (char *)signame; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9954 HWND thiswindow = window; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9955 int sigid; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9956 void **params = calloc(_DW_INTERNAL_CALLBACK_PARAMS, sizeof(void *)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9957 gint cid; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9958 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9959 /* Save the disconnect function pointer */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9960 params[1] = discfunc; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9961 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9962 /* Special case for handling notification signals, which aren't really signals */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9963 if (G_IS_NOTIFICATION(thiswindow) && strcmp(signame, DW_SIGNAL_CLICKED) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9964 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9965 char textbuf[101] = {0}; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9966 snprintf(textbuf, 100, "dw-notification-%llu-func", DW_POINTER_TO_ULONGLONG(thiswindow)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9967 g_object_set_data(G_OBJECT(_DWApp), textbuf, DW_POINTER(sigfunc)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9968 snprintf(textbuf, 100, "dw-notification-%llu-data", DW_POINTER_TO_ULONGLONG(thiswindow)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9969 g_object_set_data(G_OBJECT(_DWApp), textbuf, DW_POINTER(data)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9970 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9971 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9972 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9973 * If the window we are setting the signal on is a scrolled window we need to get |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9974 * the "real" widget type. thiswindow is the "real" widget type |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9975 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9976 if (GTK_IS_SCROLLED_WINDOW(thiswindow) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9977 #ifdef USE_WEBKIT |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9978 && !(thiswindow = (HWND)_dw_html_web_view(thiswindow)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9979 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9980 ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9981 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9982 thiswindow = (HWND)g_object_get_data(G_OBJECT(window), "_dw_user"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9983 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9984 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9985 if (strcmp(signame, DW_SIGNAL_EXPOSE) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9986 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9987 thisname = "draw"; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9988 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9989 else if (GTK_IS_MENU_ITEM(thiswindow) && strcmp(signame, DW_SIGNAL_CLICKED) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9990 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9991 thisname = "activate"; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9992 thisfunc = _findsigfunc(thisname); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9993 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9994 else if (GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_CONTEXT) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9995 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9996 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, thisfunc, discfunc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9997 params[0] = GINT_TO_POINTER(sigid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9998 params[2] = (void *)thiswindow; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9999 cid = g_signal_connect_data(G_OBJECT(thiswindow), "button_press_event", G_CALLBACK(thisfunc), params, _dw_signal_disconnect, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10000 _set_signal_handler_id(thiswindow, sigid, cid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10001 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10002 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10003 else if ((GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0) || |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10004 (GTK_IS_COMBO_BOX(thiswindow) && strcmp(signame, DW_SIGNAL_LIST_SELECT) == 0)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10005 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10006 GtkWidget *widget = thiswindow; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10007 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10008 thisname = "changed"; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10009 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10010 sigid = _set_signal_handler(widget, window, sigfunc, data, thisfunc, discfunc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10011 params[0] = GINT_TO_POINTER(sigid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10012 params[2] = (void *)thiswindow; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10013 if(GTK_IS_TREE_VIEW(thiswindow)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10014 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10015 thiswindow = (GtkWidget *)gtk_tree_view_get_selection(GTK_TREE_VIEW(thiswindow)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10016 cid = g_signal_connect_data(G_OBJECT(thiswindow), thisname, G_CALLBACK(thisfunc), params, _dw_signal_disconnect, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10017 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10018 else |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10019 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10020 cid = g_signal_connect_data(G_OBJECT(thiswindow), thisname, G_CALLBACK(_combobox_select_event), params, _dw_signal_disconnect, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10021 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10022 _set_signal_handler_id(widget, sigid, cid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10023 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10024 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10025 else if (GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_TREE_EXPAND) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10026 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10027 thisname = "row-expanded"; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10028 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10029 else if (GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_ENTER) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10030 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10031 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, _container_enter_event, discfunc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10032 params[0] = GINT_TO_POINTER(sigid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10033 params[2] = (void *)thiswindow; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10034 cid = g_signal_connect_data(G_OBJECT(thiswindow), "key_press_event", G_CALLBACK(_container_enter_event), params, _dw_signal_disconnect, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10035 _set_signal_handler_id(thiswindow, sigid, cid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10036 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10037 params = calloc(sizeof(void *), _DW_INTERNAL_CALLBACK_PARAMS); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10038 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10039 thisname = "button_press_event"; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10040 thisfunc = _findsigfunc(DW_SIGNAL_ITEM_ENTER); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10041 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10042 else if (GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_COLUMN_CLICK) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10043 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10044 /* We don't actually need a signal handler here... just need to assign the handler ID |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10045 * Since the handlers for the columns were already created in _dw_container_setup() |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10046 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10047 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, _column_click_event, discfunc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10048 g_object_set_data(G_OBJECT(thiswindow), "_dw_column_click_id", GINT_TO_POINTER(sigid+1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10049 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10050 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10051 else if (strcmp(signame, DW_SIGNAL_SET_FOCUS) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10052 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10053 thisname = "focus-in-event"; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10054 if (GTK_IS_COMBO_BOX(thiswindow)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10055 thiswindow = gtk_bin_get_child(GTK_BIN(thiswindow)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10056 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10057 #ifdef USE_WEBKIT |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10058 else if (WEBKIT_IS_WEB_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_HTML_CHANGED) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10059 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10060 thisname = "load-changed"; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10061 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10062 else if (WEBKIT_IS_WEB_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_HTML_RESULT) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10063 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10064 /* We don't actually need a signal handler here... just need to assign the handler ID |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10065 * Since the handler is created in dw_html_javasript_run() |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10066 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10067 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, _html_result_event, discfunc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10068 g_object_set_data(G_OBJECT(thiswindow), "_dw_html_result_id", GINT_TO_POINTER(sigid+1)); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10069 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10070 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10071 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10072 #if 0 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10073 else if (strcmp(signame, DW_SIGNAL_LOSE_FOCUS) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10074 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10075 thisname = "focus-out-event"; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10076 if(GTK_IS_COMBO_BOX(thiswindow)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10077 thiswindow = GTK_COMBO_BOX(thiswindow)->entry; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10078 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10079 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10080 else if (GTK_IS_SCALE(thiswindow) || GTK_IS_SCROLLBAR(thiswindow) || GTK_IS_SPIN_BUTTON(thiswindow) ) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10081 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10082 thiswindow = (GtkWidget *)g_object_get_data(G_OBJECT(thiswindow), "_dw_adjustment"); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10083 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10084 else if (GTK_IS_NOTEBOOK(thiswindow) && strcmp(signame, DW_SIGNAL_SWITCH_PAGE) == 0) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10085 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10086 thisname = "switch-page"; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10087 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10088 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10089 if (!thisfunc || !thiswindow) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10090 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10091 free(params); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10092 return; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10093 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10094 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10095 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, thisfunc, discfunc); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10096 params[0] = GINT_TO_POINTER(sigid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10097 params[2] = (void *)thiswindow; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10098 cid = g_signal_connect_data(G_OBJECT(thiswindow), thisname, G_CALLBACK(thisfunc), params, _dw_signal_disconnect, 0); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10099 _set_signal_handler_id(thiswindow, sigid, cid); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10100 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10101 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10102 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10103 * Removes callbacks for a given window with given name. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10104 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10105 * window: Window handle of callback to be removed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10106 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10107 void dw_signal_disconnect_by_name(HWND window, const char *signame) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10108 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10109 int z, count; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10110 void *thisfunc; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10111 void **params = alloca(sizeof(void *) * 3); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10112 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10113 params[2] = _find_signal_window(window, signame); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10114 count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(params[2]), "_dw_sigcounter")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10115 thisfunc = _findsigfunc(signame); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10116 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10117 for(z=0;z<count;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10118 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10119 SignalHandler sh; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10120 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10121 params[0] = GINT_TO_POINTER(z); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10122 sh = _get_signal_handler(params); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10123 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10124 if(sh.intfunc == thisfunc) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10125 _remove_signal_handler((HWND)params[2], z); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10126 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10127 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10128 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10129 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10130 * Removes all callbacks for a given window. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10131 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10132 * window: Window handle of callback to be removed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10133 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10134 void dw_signal_disconnect_by_window(HWND window) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10135 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10136 HWND thiswindow; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10137 int z, count; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10138 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10139 thiswindow = _find_signal_window(window, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10140 count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(thiswindow), "_dw_sigcounter")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10141 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10142 for(z=0;z<count;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10143 _remove_signal_handler(thiswindow, z); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10144 g_object_set_data(G_OBJECT(thiswindow), "_dw_sigcounter", NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10145 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10146 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10147 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10148 * Removes all callbacks for a given window with specified data. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10149 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10150 * window: Window handle of callback to be removed. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10151 * data: Pointer to the data to be compared against. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10152 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10153 void dw_signal_disconnect_by_data(HWND window, void *data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10154 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10155 int z, count; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10156 void **params = alloca(sizeof(void *) * 3); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10157 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10158 params[2] = _find_signal_window(window, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10159 count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(params[2]), "_dw_sigcounter")); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10160 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10161 for(z=0;z<count;z++) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10162 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10163 SignalHandler sh; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10164 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10165 params[0] = GINT_TO_POINTER(z); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10166 sh = _get_signal_handler(params); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10167 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10168 if(sh.data == data) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10169 _remove_signal_handler((HWND)params[2], z); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10170 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10171 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10172 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10173 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10174 * Converts a UTF-8 encoded string into a wide string. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10175 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10176 * utf8string: UTF-8 encoded source string. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10177 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10178 * Wide string that needs to be freed with dw_free() |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10179 * or NULL on failure. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10180 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10181 wchar_t * API dw_utf8_to_wchar(const char *utf8string) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10182 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10183 wchar_t *retval = NULL, *freeme; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10184 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10185 if(sizeof(wchar_t) == sizeof(gunichar)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10186 freeme = retval = (wchar_t *)g_utf8_to_ucs4(utf8string, -1, NULL, NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10187 else if(sizeof(wchar_t) == sizeof(gunichar2)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10188 freeme = retval = (wchar_t *)g_utf8_to_utf16(utf8string, -1, NULL, NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10189 if(retval) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10190 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10191 retval = wcsdup(retval); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10192 g_free(freeme); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10193 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10194 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10195 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10196 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10197 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10198 * Converts a wide string into a UTF-8 encoded string. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10199 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10200 * wstring: Wide source string. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10201 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10202 * UTF-8 encoded string that needs to be freed with dw_free() |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10203 * or NULL on failure. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10204 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10205 char * API dw_wchar_to_utf8(const wchar_t *wstring) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10206 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10207 char *retval = NULL, *freeme; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10208 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10209 if(sizeof(wchar_t) == sizeof(gunichar)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10210 freeme = retval = g_ucs4_to_utf8((gunichar *)wstring, -1, NULL, NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10211 else if(sizeof(wchar_t) == sizeof(gunichar2)) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10212 freeme = retval = g_utf16_to_utf8((gunichar2 *)wstring, -1, NULL, NULL, NULL); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10213 if(retval) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10214 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10215 retval = strdup(retval); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10216 g_free(freeme); |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10217 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10218 return retval; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10219 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10220 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10221 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10222 * Gets the state of the requested library feature. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10223 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10224 * feature: The requested feature for example DW_FEATURE_DARK_MODE |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10225 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10226 * DW_FEATURE_UNSUPPORTED if the library or OS does not support the feature. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10227 * DW_FEATURE_DISABLED if the feature is supported but disabled. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10228 * DW_FEATURE_ENABLED if the feature is supported and enabled. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10229 * Other value greater than 1, same as enabled but with extra info. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10230 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10231 int API dw_feature_get(DWFEATURE feature) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10232 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10233 switch(feature) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10234 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10235 #ifdef USE_WEBKIT |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10236 case DW_FEATURE_HTML: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10237 case DW_FEATURE_HTML_RESULT: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10238 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10239 case DW_FEATURE_NOTIFICATION: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10240 case DW_FEATURE_CONTAINER_STRIPE: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10241 case DW_FEATURE_UTF8_UNICODE: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10242 case DW_FEATURE_MLE_WORD_WRAP: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10243 return DW_FEATURE_ENABLED; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10244 default: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10245 return DW_FEATURE_UNSUPPORTED; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10246 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10247 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10248 |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10249 /* |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10250 * Sets the state of the requested library feature. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10251 * Parameters: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10252 * feature: The requested feature for example DW_FEATURE_DARK_MODE |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10253 * state: DW_FEATURE_DISABLED, DW_FEATURE_ENABLED or any value greater than 1. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10254 * Returns: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10255 * DW_FEATURE_UNSUPPORTED if the library or OS does not support the feature. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10256 * DW_ERROR_NONE if the feature is supported and successfully configured. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10257 * DW_ERROR_GENERAL if the feature is supported but could not be configured. |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10258 * Remarks: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10259 * These settings are typically used during dw_init() so issue before |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10260 * setting up the library with dw_init(). |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10261 */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10262 int API dw_feature_set(DWFEATURE feature, int state) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10263 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10264 switch(feature) |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10265 { |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10266 /* These features are supported but not configurable */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10267 #ifdef USE_WEBKIT |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10268 case DW_FEATURE_HTML: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10269 case DW_FEATURE_HTML_RESULT: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10270 #endif |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10271 case DW_FEATURE_NOTIFICATION: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10272 case DW_FEATURE_CONTAINER_STRIPE: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10273 case DW_FEATURE_UTF8_UNICODE: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10274 case DW_FEATURE_MLE_WORD_WRAP: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10275 return DW_ERROR_GENERAL; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10276 /* These features are supported and configurable */ |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10277 default: |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10278 return DW_FEATURE_UNSUPPORTED; |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10279 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10280 } |
5c981407b0f3
GTK4: Add experimental support for GTK4... This is in progress and doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10281 |