Compare commits
309 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8358c9845 | ||
|
|
b975c992ba | ||
|
|
a66b9ecba3 | ||
|
|
fe487d27d3 | ||
|
|
ffefc931cb | ||
|
|
936a9bb82f | ||
|
|
2cf9cfc70e | ||
|
|
8e1f6f269d | ||
|
|
4a666956be | ||
|
|
ed9c2e8b44 | ||
|
|
d5e1327f9e | ||
|
|
f25b333e33 | ||
|
|
510541dd5b | ||
|
|
7c9cc2cf39 | ||
|
|
b252a7fffd | ||
|
|
b26728291a | ||
|
|
b62fc60de7 | ||
|
|
7defce053a | ||
|
|
f322097971 | ||
|
|
8d312b1d4f | ||
|
|
3b0e9baee5 | ||
|
|
0b1b179e45 | ||
|
|
6c6b244015 | ||
|
|
725300f5f2 | ||
|
|
7d56ba7b0c | ||
|
|
832e096207 | ||
|
|
063c490570 | ||
|
|
8d55a9d665 | ||
|
|
6c21fc646d | ||
|
|
0847bed69f | ||
|
|
f3f8304436 | ||
|
|
7e6c3c0df7 | ||
|
|
25f9fd2958 | ||
|
|
b3e0707899 | ||
|
|
aa505f0ff4 | ||
|
|
66dd08d2e8 | ||
|
|
8555c23889 | ||
|
|
98d997b105 | ||
|
|
5cb538d805 | ||
|
|
7d6aff77e5 | ||
|
|
668c7604a9 | ||
|
|
e8cf1d552b | ||
|
|
5266d6322a | ||
|
|
52d2e1b6a1 | ||
|
|
4aa965149c | ||
|
|
ab40e71ec9 | ||
|
|
d8e88af7d0 | ||
|
|
1a7acfef50 | ||
|
|
f8116014c1 | ||
|
|
eedaab9236 | ||
|
|
2117f4ac7e | ||
|
|
6349f7cb2c | ||
|
|
8435d34838 | ||
|
|
0f0ede22ad | ||
|
|
43ef2e2394 | ||
|
|
b94559a288 | ||
|
|
a3cfbc84cf | ||
|
|
4143e106cc | ||
|
|
d0a29b40d6 | ||
|
|
1b7fc490af | ||
|
|
8c66060a8e | ||
|
|
e94d12f926 | ||
|
|
cde57dc1d2 | ||
|
|
42a7da51fc | ||
|
|
2bec3fad18 | ||
|
|
2f6ee99191 | ||
|
|
9a1db40746 | ||
|
|
37bedcc07a | ||
|
|
302aaa2802 | ||
|
|
9829d1ee03 | ||
|
|
aa6097e255 | ||
|
|
1d8aed6816 | ||
|
|
49680fed32 | ||
|
|
4a7d355898 | ||
|
|
0982f71b98 | ||
|
|
7363897409 | ||
|
|
2b210ff47e | ||
|
|
385164d6f9 | ||
|
|
1bafe5a8e7 | ||
|
|
52f719521a | ||
|
|
5c67089e7d | ||
|
|
af36f7765a | ||
|
|
0b0524d397 | ||
|
|
4eaccda110 | ||
|
|
16bcc7bc6d | ||
|
|
26004d36fa | ||
|
|
0b31d8a9c4 | ||
|
|
c2a843d8ed | ||
|
|
ecb8751322 | ||
|
|
d4a428d2e9 | ||
|
|
1d6172102d | ||
|
|
887540e646 | ||
|
|
18dfa1ae90 | ||
|
|
7ec269052d | ||
|
|
a3ee7a9416 | ||
|
|
92006c8e78 | ||
|
|
e6af5d49ae | ||
|
|
0dfc14aa8b | ||
|
|
6114e5b813 | ||
|
|
9c585e9210 | ||
|
|
0e3d507006 | ||
|
|
1cf5800665 | ||
|
|
3a02948170 | ||
|
|
26df647a0f | ||
|
|
ad7dc0e87f | ||
|
|
2a2323d64e | ||
|
|
3a1eebe683 | ||
|
|
520fd17eca | ||
|
|
09d32399ab | ||
|
|
c492bd10e8 | ||
|
|
0d1eb423a1 | ||
|
|
55f36bac3a | ||
|
|
3d19b7ce55 | ||
|
|
2ab408a700 | ||
|
|
1c77b5f926 | ||
|
|
13de9dc34f | ||
|
|
6788abaa48 | ||
|
|
39a05c0b55 | ||
|
|
8051b9d2bc | ||
|
|
30533f0397 | ||
|
|
01c3cd84f5 | ||
|
|
49efbf9b1d | ||
|
|
0f9fe89727 | ||
|
|
d7aa6a88fb | ||
|
|
c4089778fb | ||
|
|
61ca241924 | ||
|
|
79d880ccb7 | ||
|
|
20fee708a3 | ||
|
|
1a099c2ced | ||
|
|
ab7989217a | ||
|
|
6e28c40061 | ||
|
|
9a5ad5d44e | ||
|
|
e19f939b53 | ||
|
|
977b13d37f | ||
|
|
bfd68b4357 | ||
|
|
71824a2cd5 | ||
|
|
e2ae4aec47 | ||
|
|
59d586e2ff | ||
|
|
07a8601adf | ||
|
|
b1446447fc | ||
|
|
308adaa6db | ||
|
|
32cd050cfe | ||
|
|
740b70ea0c | ||
|
|
4268cd7312 | ||
|
|
5d81d2ab28 | ||
|
|
68bc2c51db | ||
|
|
acb95ed9da | ||
|
|
c36ca76bb8 | ||
|
|
30f22e0208 | ||
|
|
4e01061296 | ||
|
|
2be5abf4ed | ||
|
|
f59f2039c0 | ||
|
|
a20f83d9a9 | ||
|
|
4bf5d761bc | ||
|
|
8eb7761e72 | ||
|
|
c05d6f2d12 | ||
|
|
f553b79b70 | ||
|
|
4098ac22ff | ||
|
|
2f5621e566 | ||
|
|
93e1585614 | ||
|
|
5b3cc69b43 | ||
|
|
7033e33822 | ||
|
|
b2c30ad95d | ||
|
|
f2cfc17be8 | ||
|
|
186a0455be | ||
|
|
e0ea1f0c14 | ||
|
|
11f79ebe18 | ||
|
|
c2906f2bea | ||
|
|
a74e338517 | ||
|
|
d38e339ebb | ||
|
|
b47085512c | ||
|
|
cb98231c7d | ||
|
|
36e83663cf | ||
|
|
102b1de4b4 | ||
|
|
d362159181 | ||
|
|
9b7fd1bbe5 | ||
|
|
9457fe86d4 | ||
|
|
13fa9d3819 | ||
|
|
3f5c7acc33 | ||
|
|
7de464ffe8 | ||
|
|
c88afb81f9 | ||
|
|
34e324ca70 | ||
|
|
7bd32a06cf | ||
|
|
ba0b7257a7 | ||
|
|
690e34968a | ||
|
|
923f3f6992 | ||
|
|
f0f650948a | ||
|
|
03a7c4551b | ||
|
|
6b411f4b47 | ||
|
|
b78286eab5 | ||
|
|
dac3ffed60 | ||
|
|
16aa9c1964 | ||
|
|
ac05ab301d | ||
|
|
de26d9af9b | ||
|
|
8cff9d3307 | ||
|
|
995d97b001 | ||
|
|
a7960ed953 | ||
|
|
0328873baf | ||
|
|
babfb28c3c | ||
|
|
8a544b8912 | ||
|
|
75a00da8d1 | ||
|
|
38614a78b6 | ||
|
|
b44ec526b6 | ||
|
|
177354df02 | ||
|
|
2a2fff763d | ||
|
|
3c03a6787d | ||
|
|
f9739e8343 | ||
|
|
85d4cd0f43 | ||
|
|
e648c2d68f | ||
|
|
467e4e73c1 | ||
|
|
b141619b50 | ||
|
|
3f04c019cd | ||
|
|
3872c32d4a | ||
|
|
df0b05ef2b | ||
|
|
70b3b3e6e1 | ||
|
|
a783d668f1 | ||
|
|
a6e2c24b60 | ||
|
|
8a0d67391c | ||
|
|
63955ec2e2 | ||
|
|
077b5109a4 | ||
|
|
444c9529db | ||
|
|
600eaaea09 | ||
|
|
60c008eb99 | ||
|
|
27c086bd95 | ||
|
|
c91f2c0cfa | ||
|
|
3f4411ed52 | ||
|
|
f8170cbd7c | ||
|
|
8ecd7ef5ae | ||
|
|
0ac28d23a4 | ||
|
|
ced74f4435 | ||
|
|
16c6ee03ae | ||
|
|
eac28852ed | ||
|
|
f87ee7e51a | ||
|
|
9ce0cb6037 | ||
|
|
85764dad33 | ||
|
|
9addd8da2c | ||
|
|
bfc969f697 | ||
|
|
e8a447e002 | ||
|
|
8fa6f19aa2 | ||
|
|
85dd78b7d8 | ||
|
|
bc8e40387b | ||
|
|
566a13a6c0 | ||
|
|
9280285954 | ||
|
|
135cdd43a9 | ||
|
|
6e7f4a99e9 | ||
|
|
cfd3a51369 | ||
|
|
ab4fed04fe | ||
|
|
c86bf9bae2 | ||
|
|
b8e7ea1f11 | ||
|
|
54a9eb416d | ||
|
|
f9ad283402 | ||
|
|
8cde2c5c21 | ||
|
|
bc98ea9ce1 | ||
|
|
294cfcdb22 | ||
|
|
3ef2c37a83 | ||
|
|
78290be1c0 | ||
|
|
c31eb969ba | ||
|
|
68fcbef5a1 | ||
|
|
cc4dc8339d | ||
|
|
c57f1e318e | ||
|
|
bd9ddcb231 | ||
|
|
6acde3e1ce | ||
|
|
3832600822 | ||
|
|
fa107ded2a | ||
|
|
8eb77dfea2 | ||
|
|
9c8ed97e83 | ||
|
|
c8e5c809ed | ||
|
|
9b4919dcb8 | ||
|
|
96a7435911 | ||
|
|
7c698ad46c | ||
|
|
9a9070c26d | ||
|
|
aebd3d2df2 | ||
|
|
affaf4f9d2 | ||
|
|
4f3495f955 | ||
|
|
d19d3c5dca | ||
|
|
a8afd462c0 | ||
|
|
093dfedf74 | ||
|
|
48a15b7349 | ||
|
|
59436967d5 | ||
|
|
c5327ecc31 | ||
|
|
617a879dfe | ||
|
|
b7a6cd6750 | ||
|
|
ffc1084029 | ||
|
|
5724801800 | ||
|
|
309d7377e7 | ||
|
|
2ff460a6c8 | ||
|
|
3573f8b5f3 | ||
|
|
e583ab045f | ||
|
|
3d7c2d6634 | ||
|
|
47933b73db | ||
|
|
1432078569 | ||
|
|
6cfdaaa740 | ||
|
|
d94b21a8df | ||
|
|
cfda5f0035 | ||
|
|
5d6fe2d05f | ||
|
|
fb66cb05df | ||
|
|
5d5bbd1a21 | ||
|
|
c45ab2b2d6 | ||
|
|
4a4f0aedf3 | ||
|
|
db51126e3b | ||
|
|
2737494599 | ||
|
|
e9e7e4c86b | ||
|
|
7f17ced74b | ||
|
|
8f8b0f68ff | ||
|
|
f9e5e12bcc | ||
|
|
cb6412978c | ||
|
|
120df3b8b7 | ||
|
|
fabfc17d93 | ||
|
|
4db2561dd5 |
@@ -8,6 +8,6 @@ Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
configure
|
||||
gtk+.xconfig
|
||||
gtk-config
|
||||
config.cache
|
||||
|
||||
|
||||
28
AUTHORS
28
AUTHORS
@@ -1,3 +1,25 @@
|
||||
Peter Mattis (petm@xcf.berkeley.edu)
|
||||
Spencer Kimball (spencer@xcf.berkeley.edu)
|
||||
Josh MacDonald (jmacd@xcf.berkeley.edu)
|
||||
Original Authors
|
||||
----------------
|
||||
Peter Mattis <petm@xcf.berkeley.edu>
|
||||
Spencer Kimball <spencer@xcf.berkeley.edu>
|
||||
Josh MacDonald <jmacd@xcf.berkeley.edu>
|
||||
|
||||
|
||||
The GTK+ Team (in alphabetical order)
|
||||
-------------------------------------
|
||||
Shawn T. Amundson <amundson@gtk.org>
|
||||
Jerome Bolliet <bolliet@in2p3.fr>
|
||||
Tony Gale <gale@gtk.org>
|
||||
Lars Hamann <lars@gtk.org>
|
||||
Tim Janik <timj@gtk.org>
|
||||
Stefan Jeske <stefan@gtk.org>
|
||||
Elliot Lee <sopwith@gtk.org>
|
||||
Ian Main <imain@gtk.org>
|
||||
Fedrerico Mena <quartic@gtk.org>
|
||||
Paolo Molaro <lupus@lettere.unipd.it>
|
||||
Jay Painter <jpaint@gtk.org>
|
||||
Manish Singh <manish@gtk.org>
|
||||
Owen Taylor <otaylor@gtk.org>
|
||||
|
||||
There are many others who have contributed patches; we thank them,
|
||||
GTK+ is much better because of them.
|
||||
|
||||
9
COPYING
9
COPYING
@@ -2,7 +2,7 @@
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
@@ -436,7 +436,7 @@ DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Libraries
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
@@ -463,8 +463,9 @@ convey the exclusion of warranty; and each file should have at least the
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
|
||||
2040
ChangeLog.pre-2-0
2040
ChangeLog.pre-2-0
File diff suppressed because it is too large
Load Diff
2040
ChangeLog.pre-2-10
2040
ChangeLog.pre-2-10
File diff suppressed because it is too large
Load Diff
2040
ChangeLog.pre-2-2
2040
ChangeLog.pre-2-2
File diff suppressed because it is too large
Load Diff
2040
ChangeLog.pre-2-4
2040
ChangeLog.pre-2-4
File diff suppressed because it is too large
Load Diff
2040
ChangeLog.pre-2-6
2040
ChangeLog.pre-2-6
File diff suppressed because it is too large
Load Diff
2040
ChangeLog.pre-2-8
2040
ChangeLog.pre-2-8
File diff suppressed because it is too large
Load Diff
9
HACKING
9
HACKING
@@ -2,12 +2,11 @@ If you want to hack on the Gtk+ project, it will make you life easier
|
||||
to have the following packages installed:
|
||||
|
||||
- GNU autoconf 2.12
|
||||
- GNU automake 1.2d
|
||||
Available in ftp://ftp.cygnus.com/pub/tromey
|
||||
- GNU libtool 1.0h
|
||||
Available in ftp://alpha.gnu.org/gnu/
|
||||
- GNU automake 1.3
|
||||
(Beta releases are at ftp://ftp.cygnus.com/pub/tromey)
|
||||
- GNU libtool 1.2
|
||||
|
||||
These should be available by ftp from prep.ai.mit.edu or any of the
|
||||
These should be available by ftp from ftp.gnu.org or any of the
|
||||
fine GNU mirrors. Beta software can be found at alpha.gnu.org.
|
||||
|
||||
If you are accessing gtk+ via CVS, then you will need to take several
|
||||
|
||||
139
INSTALL
139
INSTALL
@@ -1,36 +1,137 @@
|
||||
The 'configure' script can be given a number of options to
|
||||
enable and disable various features. For a complete list,
|
||||
type:
|
||||
Simple install procedure
|
||||
========================
|
||||
|
||||
% gzip -cd gtk+-1.0.4.tar.gz | tar xvf - # unpack the sources
|
||||
% cd gtk+-1.0.4 # change to the toplevel directory
|
||||
% ./configure # run the `configure' script
|
||||
% make # build GTK
|
||||
[ Become root if necessary ]
|
||||
% make install # install GTK
|
||||
|
||||
The Nitty-Gritty
|
||||
================
|
||||
|
||||
The 'configure' script can be given a number of options to enable
|
||||
and disable various features. For a complete list, type:
|
||||
|
||||
./configure --help
|
||||
|
||||
A few of the more important ones:
|
||||
|
||||
* --prefix=PREFIX install architecture-independent files in PREFIX
|
||||
[ Defaults to /usr/local ]
|
||||
|
||||
* --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
|
||||
[ Defaults to the value given to --prefix ]
|
||||
|
||||
* --with-xinput=[no/gxi/xfree] support XInput [default=no]
|
||||
|
||||
The --with-xinput flag specifies whether to compile with support
|
||||
for the XInput extension (mainly used for graphics tablets), and
|
||||
which form of support to use:
|
||||
|
||||
no : no support
|
||||
gxi : Use generic XInput support
|
||||
xfree : Use special features in the Wacom drivers in XFree86 3.3.1
|
||||
and later.
|
||||
|
||||
For more information, follow the link from http://www.gtk.org
|
||||
|
||||
* --enable-xim support XIM [default=yes]
|
||||
|
||||
Specifying --disable-xim will disable support for entering
|
||||
internationalized text using X Input Methods. This will give
|
||||
some slight savings in speed and memory use and might be necessary
|
||||
internationalized text using X Input Methods. This will give some
|
||||
slight savings in speed and memory use and might be necessary
|
||||
with older versions of X.
|
||||
|
||||
* --with-locale=LOCALE locale name you want to use
|
||||
* --with-locale=LOCALE locale name you want to use
|
||||
|
||||
The --with-locale options is used to determine if your operating
|
||||
system has support for the locale you will be using. If not, X's built
|
||||
in locale support will be used.
|
||||
system has support for the locale you will be using. If not, X's
|
||||
built in locale support will be used.
|
||||
|
||||
Because of bugs in autoconf, it is necessary to specify this option
|
||||
even if your LANG environment variable is correctly set.
|
||||
Because of bugs in autoconf, it is necessary to specify this
|
||||
option even if your LANG environment variable is correctly set.
|
||||
|
||||
This option does not determine which locale GTK will use at
|
||||
runtime. That will be determined from the usual environment variables.
|
||||
If you will be using multiple locales with GTK, specify the one
|
||||
for which your operating system has the worst support for the
|
||||
--with-locale option.
|
||||
runtime. That will be determined from the usual environment
|
||||
variables. If you will be using multiple locales with GTK,
|
||||
specify the one for which your operating system has the worst
|
||||
support for the --with-locale option.
|
||||
|
||||
|
||||
Note for using XIM support with kinput2
|
||||
---------------------------------------
|
||||
Options can be given to the compiler and linker by setting
|
||||
environment variables before running configure. A few of the more
|
||||
important ones:
|
||||
|
||||
There is a bug in older versions of kinput2 that will cause
|
||||
GTK to hang when destroying a text entry. The latest versions
|
||||
of kinput is available from:
|
||||
CC : The C compiler to use
|
||||
CPPFLAGS : Flags for the C preprocesser such as -I and -D
|
||||
CFLAGS : C compiler flags
|
||||
|
||||
The most important use of this is to set the
|
||||
optimization/debugging flags. For instance, to compile with no
|
||||
debugging information at all, run configure as:
|
||||
|
||||
CFLAGS=-O2 ./configure # Bourne compatible shells (sh/bash/zsh)
|
||||
|
||||
or,
|
||||
|
||||
setenv CFLAGS -O2 ; ./configure # csh and variants
|
||||
|
||||
|
||||
Installation directories
|
||||
========================
|
||||
|
||||
The location of the installed files is determined by the --prefix
|
||||
and --exec-prefix options given to configure. There are also more
|
||||
detailed flags to control individual directories. However, the
|
||||
use of these flags is not tested.
|
||||
|
||||
One particular detail to note, is that the architecture-dependent
|
||||
include file glibconfig.h is installed in:
|
||||
|
||||
$exec_pref/lib/glib/include/
|
||||
|
||||
if you have a version in $prefix/include, this is out of date
|
||||
and should be deleted.
|
||||
|
||||
A shell script gtk-config is created during the configure
|
||||
process, and installed in the bin/ directory
|
||||
($exec_prefix/bin). This is used to determine the location of GTK
|
||||
when building applications. If you move GTK after installation,
|
||||
it will be necessary to edit this file.
|
||||
|
||||
For complete details, see the file docs/gtk-config.txt
|
||||
|
||||
|
||||
Notes for using XIM support for Japanese input
|
||||
==============================================
|
||||
|
||||
* There is a bug in older versions of kinput2 that will cause GTK
|
||||
to hang when destroying a text entry. The latest versions of
|
||||
kinput is available from:
|
||||
|
||||
ftp://ftp.sra.co.jp/pub/x11/kinput2
|
||||
|
||||
* The locale information file for the ja_JP EUC locale
|
||||
distributed with some recent versions of X11 specifies to use the
|
||||
C library multibyte functions. Unless your C library has support
|
||||
for Japanese locales, this is incorrect, and will cause problems
|
||||
for GTK's internationalization.
|
||||
|
||||
(In particular, this occurs with GNU libc 2.0 and 2.1, in which
|
||||
the multibyte functions always translate to and from UTF-8; but
|
||||
the problem may occur for other C libraries, and other operating
|
||||
systems as well.)
|
||||
|
||||
To fix this, change the line:
|
||||
|
||||
use_stdc_env True
|
||||
|
||||
to
|
||||
|
||||
use_stdc_env False
|
||||
|
||||
in the file /usr/X11R6/lib/X11/locale/ja_JP/XLC_LOCALE.
|
||||
|
||||
|
||||
|
||||
70
Makefile.am
70
Makefile.am
@@ -3,10 +3,76 @@
|
||||
SRC_SUBDIRS = glib gdk gtk
|
||||
SUBDIRS = $(SRC_SUBDIRS) docs
|
||||
|
||||
bin_SCRIPTS = gtk-config
|
||||
|
||||
EXTRA_DIST = \
|
||||
gtk+.prj \
|
||||
gtk+.spec \
|
||||
gtk.m4 \
|
||||
makecopyright \
|
||||
TODO
|
||||
TODO \
|
||||
examples/aspectframe/Makefile \
|
||||
examples/aspectframe/aspectframe.c \
|
||||
examples/buttons/Makefile \
|
||||
examples/buttons/buttons.c \
|
||||
examples/buttons/info.xpm \
|
||||
examples/entry/Makefile \
|
||||
examples/entry/entry.c \
|
||||
examples/eventbox/Makefile \
|
||||
examples/eventbox/eventbox.c \
|
||||
examples/filesel/Makefile \
|
||||
examples/filesel/filesel.c \
|
||||
examples/gtkdial/Makefile \
|
||||
examples/gtkdial/dial_test.c \
|
||||
examples/gtkdial/gtkdial.c \
|
||||
examples/gtkdial/gtkdial.h \
|
||||
examples/helloworld/Makefile \
|
||||
examples/helloworld/helloworld.c \
|
||||
examples/helloworld2/Makefile \
|
||||
examples/helloworld2/helloworld2.c \
|
||||
examples/list/Makefile \
|
||||
examples/list/list.c \
|
||||
examples/menu/Makefile \
|
||||
examples/menu/menu.c \
|
||||
examples/menu/menufactory.c \
|
||||
examples/menu/menufactory.h \
|
||||
examples/menu/mfmain.c \
|
||||
examples/menu/mfmain.h \
|
||||
examples/notebook/Makefile \
|
||||
examples/notebook/notebook.c \
|
||||
examples/packbox/Makefile \
|
||||
examples/packbox/packbox.c \
|
||||
examples/paned/Makefile \
|
||||
examples/paned/paned.c \
|
||||
examples/pixmap/Makefile \
|
||||
examples/pixmap/pixmap.c \
|
||||
examples/progressbar/Makefile \
|
||||
examples/progressbar/progressbar.c \
|
||||
examples/radiobuttons/Makefile \
|
||||
examples/radiobuttons/radiobuttons.c \
|
||||
examples/rulers/Makefile \
|
||||
examples/rulers/rulers.c \
|
||||
examples/scribble-simple/Makefile \
|
||||
examples/scribble-simple/scribble-simple.c \
|
||||
examples/scrolledwin/Makefile \
|
||||
examples/scrolledwin/scrolledwin.c \
|
||||
examples/selection/Makefile \
|
||||
examples/selection/gettargets.c \
|
||||
examples/selection/setselection.c \
|
||||
examples/statusbar/Makefile \
|
||||
examples/statusbar/statusbar.c \
|
||||
examples/table/Makefile \
|
||||
examples/table/table.c \
|
||||
examples/tictactoe/Makefile \
|
||||
examples/tictactoe/tictactoe.c \
|
||||
examples/tictactoe/tictactoe.h \
|
||||
examples/tictactoe/ttt_test.c \
|
||||
examples/wheelbarrow/Makefile \
|
||||
examples/wheelbarrow/wheelbarrow.c \
|
||||
examples/find-examples.sh
|
||||
|
||||
|
||||
m4datadir = $(datadir)/aclocal
|
||||
m4data_DATA = gtk.m4
|
||||
|
||||
.PHONY: files populate checkin release
|
||||
|
||||
|
||||
353
Makefile.in
353
Makefile.in
@@ -1,353 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.2c from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = .
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = true
|
||||
PRE_INSTALL = true
|
||||
POST_INSTALL = true
|
||||
NORMAL_UNINSTALL = true
|
||||
PRE_UNINSTALL = true
|
||||
POST_UNINSTALL = true
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NM = @NM@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
VERSION = @VERSION@
|
||||
x_cflags = @x_cflags@
|
||||
x_includes = @x_includes@
|
||||
x_ldflags = @x_ldflags@
|
||||
x_libs = @x_libs@
|
||||
xinput_progs = @xinput_progs@
|
||||
|
||||
SRC_SUBDIRS = glib gdk gtk
|
||||
SUBDIRS = $(SRC_SUBDIRS) docs
|
||||
|
||||
EXTRA_DIST = gtk+.prj makecopyright TODO REFCOUNTING BUGS
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES = gtk+.xconfig
|
||||
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
|
||||
Makefile.in NEWS TODO acconfig.h aclocal.m4 config.guess config.h.in \
|
||||
config.sub configure configure.in gtk+.xconfig.in install-sh ltconfig \
|
||||
ltmain.sh missing mkinstalldirs stamp-h.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
$(ACLOCAL_M4): @MAINT@ configure.in
|
||||
cd $(srcdir) && $(ACLOCAL)
|
||||
|
||||
config.status: $(srcdir)/configure
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: @MAINT@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
config.h: stamp-h
|
||||
@:
|
||||
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=config.h \
|
||||
$(SHELL) ./config.status
|
||||
@echo timestamp > stamp-h
|
||||
$(srcdir)/config.h.in: @MAINT@$(srcdir)/stamp-h.in
|
||||
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@echo timestamp > $(srcdir)/stamp-h.in
|
||||
|
||||
mostlyclean-hdr:
|
||||
|
||||
clean-hdr:
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h
|
||||
|
||||
maintainer-clean-hdr:
|
||||
gtk+.xconfig: $(top_builddir)/config.status gtk+.xconfig.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
all-recursive install-data-recursive install-exec-recursive \
|
||||
installdirs-recursive install-recursive uninstall-recursive \
|
||||
check-recursive installcheck-recursive info-recursive dvi-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
for subdir in $(SUBDIRS); do \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $$target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
rev=''; for subdir in $(SUBDIRS); do rev="$$subdir $$rev"; done; \
|
||||
for subdir in $$rev; do \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $$target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
(cd $$subdir && $(MAKE) tags); \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES)
|
||||
here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS)
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
done; \
|
||||
test -z "$(ETAGS_ARGS)config.h.in$(SOURCES)$(HEADERS)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $(SOURCES) $(HEADERS) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
-rm -rf $(distdir)
|
||||
GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
dc_install_base=`cd $(distdir)/=inst && pwd`; \
|
||||
cd $(distdir)/=build \
|
||||
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
|
||||
&& $(MAKE) \
|
||||
&& $(MAKE) dvi \
|
||||
&& $(MAKE) check \
|
||||
&& $(MAKE) install \
|
||||
&& $(MAKE) installcheck \
|
||||
&& $(MAKE) dist
|
||||
-rm -rf $(distdir)
|
||||
@echo "========================"; \
|
||||
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||
echo "========================"
|
||||
dist: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
dist-all: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
distdir: $(DISTFILES)
|
||||
-rm -rf $(distdir)
|
||||
mkdir $(distdir)
|
||||
-chmod 777 $(distdir)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
for subdir in $(SUBDIRS); do \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
chmod 777 $(distdir)/$$subdir; \
|
||||
(cd $$subdir && $(MAKE) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
|
||||
|| exit 1; \
|
||||
done
|
||||
info: info-recursive
|
||||
dvi: dvi-recursive
|
||||
check: all-am
|
||||
$(MAKE) check-recursive
|
||||
installcheck: installcheck-recursive
|
||||
all-recursive-am: config.h
|
||||
$(MAKE) all-recursive
|
||||
|
||||
all-am: Makefile config.h
|
||||
|
||||
install-exec: install-exec-recursive
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data: install-data-recursive
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-recursive
|
||||
@:
|
||||
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
all: all-recursive-am all-am
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs: installdirs-recursive
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic
|
||||
|
||||
clean-am: clean-hdr clean-tags clean-generic mostlyclean-am
|
||||
|
||||
distclean-am: distclean-hdr distclean-tags distclean-generic clean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \
|
||||
maintainer-clean-generic distclean-am
|
||||
|
||||
mostlyclean: mostlyclean-recursive mostlyclean-am
|
||||
|
||||
clean: clean-recursive clean-am
|
||||
|
||||
distclean: distclean-recursive distclean-am
|
||||
-rm -f config.status
|
||||
-rm -f libtool
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive maintainer-clean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-rm -f config.status
|
||||
|
||||
.PHONY: default mostlyclean-hdr distclean-hdr clean-hdr \
|
||||
maintainer-clean-hdr install-data-recursive uninstall-data-recursive \
|
||||
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
|
||||
uninstalldirs-recursive all-recursive check-recursive \
|
||||
installcheck-recursive info-recursive dvi-recursive \
|
||||
mostlyclean-recursive distclean-recursive clean-recursive \
|
||||
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
|
||||
distclean-tags clean-tags maintainer-clean-tags distdir info dvi \
|
||||
installcheck all-recursive-am all-am install-exec install-data install \
|
||||
uninstall all installdirs mostlyclean-generic distclean-generic \
|
||||
clean-generic maintainer-clean-generic clean mostlyclean distclean \
|
||||
maintainer-clean
|
||||
|
||||
|
||||
.PHONY: files populate checkin release
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
||||
@for subdir in $(SUBDIRS); do \
|
||||
files=`cd $$subdir; $(MAKE) files | grep -v "make\[[1-9]\]"`; \
|
||||
for file in $$files; do \
|
||||
echo $$subdir/$$file; \
|
||||
done; \
|
||||
done
|
||||
|
||||
populate:
|
||||
@echo "populating project"
|
||||
@files=`$(MAKE) files | grep -v "make\[[1-9]\]"`; prcs populate -d gtk+.prj $$files
|
||||
|
||||
checkin: populate
|
||||
@echo "checking in project"
|
||||
@prcs checkin
|
||||
|
||||
release:
|
||||
$(MAKE) dist distdir=$(PACKAGE)`date +"%y%m%d"`
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
76
NEWS
76
NEWS
@@ -1,3 +1,79 @@
|
||||
Overview of Changes in GTK+ 1.0.4:
|
||||
|
||||
* Documentation changes (Thanks to Tony Gale!)
|
||||
* autoconf fix for x_lib variable
|
||||
* fixed pixmap clipping in gtkclist
|
||||
|
||||
Overview of Changes in GTK+ 1.0.3:
|
||||
|
||||
* Bug fixes, including fix for visuals on SGI machines
|
||||
|
||||
Overview of Changes in GTK+ 1.0.2:
|
||||
|
||||
* Speedups for type creation and especially gtk_type_is_a() checks.
|
||||
* Speedups in signal lookup, creation and emissions and connection handling.
|
||||
* Additions to the signal handling API (e.g. *_emitv).
|
||||
* Minor speedups with object data allocation and destruction.
|
||||
* Newly included file gtkfeatures.h which defines compatibility macros to
|
||||
test for certain API features upon program compilation.
|
||||
* Cleanups to give less warnings on 64-bit platforms.
|
||||
* Many bugs fixed, including:
|
||||
- A segfault with selections on Solaris and IRIX.
|
||||
- A segfault that occured for all keypresses on Linux/Alpha.
|
||||
|
||||
Overview of Changes in GTK+ 1.0.1:
|
||||
|
||||
* Significant speedups to widget creation and destruction
|
||||
* Upgrade to libtool-1.2
|
||||
* Lots of bug fixes, including one that fixed a major memory leak
|
||||
in 1.0.0.
|
||||
|
||||
Overview of Changes in GTK+ 1.0.0:
|
||||
|
||||
* A few bug fixes.
|
||||
|
||||
Overview of Changes in GTK+ 0.99.10:
|
||||
|
||||
* Lots of bug fixes
|
||||
* Documentation improvements
|
||||
* Better looking handlebox
|
||||
* A few convenience functions
|
||||
|
||||
Overview of Changes in GTK+ 0.99.9:
|
||||
|
||||
* Added examples directory, even more examples soon
|
||||
* Added optional word wrap to gtktext
|
||||
* Changes to gtkhandlebox
|
||||
* Lots of bug fixes
|
||||
|
||||
Overview of Changes in GTK+ 0.99.8:
|
||||
|
||||
* Compilation and configuration fixes
|
||||
* DND Fixes
|
||||
* New test in testgtk: cursors
|
||||
* Tutorial updates/additions
|
||||
* Few more FAQ additions
|
||||
* More prep for 1.0
|
||||
|
||||
Overview of Changes in GTK+ 0.99.7:
|
||||
|
||||
* This release is mainly because 0.99.6 did not compile completely
|
||||
due to a missing file.
|
||||
* Fixes to Gtk's quit handlers.
|
||||
|
||||
Overview of Changes in GTK+ 0.99.6:
|
||||
|
||||
* Intermediate release to become 1.0.
|
||||
* More signedness corrections for handler functions in gtkmain.h.
|
||||
* Semantics of GtkWidget::delete_event changed.
|
||||
* Documentation updates.
|
||||
* Inclusion of Gtk tutorial.
|
||||
* Implementation of a new shutdown method for GtkObject's executed prior to
|
||||
actual destruction. WARNING: this breaks binary compatibility, programs using
|
||||
Gtk need to be recompiled.
|
||||
* Clean ups due to compiler warnings.
|
||||
* Various widget fixes.
|
||||
|
||||
Overview of Fixes in GTK+ 0.99.5:
|
||||
|
||||
* Signal signedness and naming corrections
|
||||
|
||||
71
README
71
README
@@ -1,18 +1,75 @@
|
||||
General Information
|
||||
===================
|
||||
|
||||
This is GTK+ version 0.99.5. GTK, which stands for the Gimp ToolKit,
|
||||
is a library for creating graphical user interfaces.
|
||||
This is GTK+ version 1.0.4. GTK+, which stands for the Gimp ToolKit,
|
||||
is a library for creating graphical user interfaces for the X Window
|
||||
System. It is designed to be small, efficient, and flexible. GTK+ is
|
||||
written in C with a very object-oriented approach.
|
||||
|
||||
The official ftp site is:
|
||||
ftp://ftp.gimp.org/pub/gtk
|
||||
ftp://ftp.gtk.org/pub/gtk
|
||||
|
||||
The official web site is:
|
||||
http://www.gimp.org/gtk
|
||||
|
||||
Patches can be uploaded to:
|
||||
ftp://ftp.gimp.org/incoming
|
||||
http://www.gtk.org/
|
||||
|
||||
A mailing list is located at:
|
||||
gtk-list@redhat.com
|
||||
|
||||
To subscribe: mail -s subscribe gtk-list-request@redhat.com < /dev/null
|
||||
(Send mail to gtk-list-request@redhat.com with the subject "subscribe")
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
See the file 'INSTALL'
|
||||
|
||||
How to report bugs
|
||||
==================
|
||||
|
||||
To report a bug, send mail either to gtk-list, as mentioned
|
||||
above, or to gtk-bugs@gtk.org. If you send mail to gtk-list, you
|
||||
must be subscribed yourself.
|
||||
|
||||
In the mail include:
|
||||
|
||||
* The version of GTK
|
||||
|
||||
* Information about your system. For instance:
|
||||
|
||||
- What operating system and version
|
||||
- What version of X
|
||||
- For Linux, what version of the C library
|
||||
|
||||
And anything else you think is relevant.
|
||||
|
||||
* How to reproduce the bug.
|
||||
|
||||
If you can reproduce it with the testgtk program that is built
|
||||
in the gtk/ subdirectory, that will be most convenient. Otherwise,
|
||||
please include a short test program that exhibits the behavior.
|
||||
As a last resort, you can also provide a pointer to a larger piece
|
||||
of software that can be downloaded.
|
||||
|
||||
(Bugs that can be reproduced within the GIMP are almost as good
|
||||
as bugs that can be reproduced in testgtk. If you are reporting a
|
||||
bug found with the GIMP, please include the version number of the GIMP
|
||||
you are using)
|
||||
|
||||
* If the bug was a crash, the exact text that was printed out
|
||||
when the crash occured.
|
||||
|
||||
* Further information such as stack traces may be useful, but
|
||||
is not necessary. If you do send a stack trace, and the error
|
||||
is an X error, it will be more useful if the stacktrace
|
||||
is produced running the test program with the --sync command
|
||||
line option.
|
||||
|
||||
Patches
|
||||
=======
|
||||
|
||||
Patches can be uploaded to the incoming/ directory on
|
||||
ftp.gtk.org. Please follow the instructions there, and include
|
||||
your name and email address in the README file.
|
||||
|
||||
If the patch fixes a bug, it is usually a good idea to include
|
||||
all the information described in "How to Report Bugs".
|
||||
|
||||
169
TODO
169
TODO
@@ -1,34 +1,11 @@
|
||||
TODO BEFORE GTK 1.0
|
||||
-------------------
|
||||
|
||||
Bugs:
|
||||
* pasting into a GtkEntry that already has a very long string,
|
||||
causes the app to hang.
|
||||
|
||||
* Vertical scrollbar: the expose event looks hosed and is causing
|
||||
quite a bit of flickering
|
||||
Actually this affects both scrollbar implementation, you can best
|
||||
tell if you run the application with --sync (timj)
|
||||
|
||||
* signal parameters don't seem to get refreshed on recursive invokations
|
||||
of GTK_NO_RECURSE signals, which causes the restarted emissions to loose
|
||||
their actual point, i.e. parameter changes on the restarted emission,
|
||||
needs further investigation.
|
||||
* Scrolled windows (GtkList?) get cought in an endless reallocation loop
|
||||
under certain (rare) circumstances.
|
||||
|
||||
* Widget redrawing when the window resizes sometimes messes up.
|
||||
GtkLabels sometimes redraw without clearing up the underlying background on
|
||||
window resizes.
|
||||
|
||||
* Are there still some GtkCList changes outstanding? (Jay Painter)
|
||||
GtkCList is derived from GtkContainer but doesn't implement the
|
||||
need_resize, focus, add and remove methods from containers.
|
||||
it should at least issue a warning upon invokation of not supported
|
||||
member functions.
|
||||
|
||||
* GtkTree and GtkList should express in their *_add implementations,
|
||||
that they expect GtkListItems/GtkTreeItems as children. Similar
|
||||
things might apply to other containers.
|
||||
|
||||
* delay dnd settings to take effect once a widget is realized, this is
|
||||
to avoid force realizations. i think this goes along with owens dnd
|
||||
changes?
|
||||
@@ -57,14 +34,11 @@ Bugs:
|
||||
segfault in malloc
|
||||
-timj
|
||||
|
||||
* Change bitfields to guints from enums for C++ ?
|
||||
* Change bitfields to guints from enums, or vice versa?
|
||||
|
||||
* Force paned window handle to be kept on screen
|
||||
* Expose events aren't being generated correctly for DND demo
|
||||
|
||||
Additions:
|
||||
* widgets which are redrawn because of a gtk_widget_draw(,NULL) should
|
||||
be removed from the redraw queue.
|
||||
|
||||
* GScanner: it might be good to ues stdio and getch() instead of 1-character
|
||||
reads. so one can take advantage of buffering. Currently each read() takes
|
||||
a separate syscall.
|
||||
@@ -89,13 +63,19 @@ Additions:
|
||||
void gtk_rc_string_export (const gchar *rc_additions,
|
||||
gboolean override_rc_styles);
|
||||
|
||||
* Configure events for windows that no longer exist fail in
|
||||
XTranslateCoordinates
|
||||
* Should release grab before activating menu item (and remove
|
||||
menu from screen?)
|
||||
|
||||
TODO AFTER GTK 1.0
|
||||
------------------
|
||||
|
||||
* Make all widget attributes configurable after the widget is created (timj).
|
||||
|
||||
* Widgets dervied from GtkButton need to be able to override
|
||||
GtkButtonClass.paint. e.g. redrawing of GtkToggleButton with CAN_DEFAULT
|
||||
is messed up otheriwse. This does in fact not only apply to (toggle)buttons,
|
||||
we should introduce a common paint member for the GtkWidgetClass.
|
||||
|
||||
* Radio buttons need to display CAN/HAS_DEFAULT correctly.
|
||||
|
||||
* GtkCList improvements. (Jay Painter)
|
||||
|
||||
* Seperate GtkObject and signaling system from Gdk dependancies?
|
||||
|
||||
@@ -113,6 +93,9 @@ TODO AFTER GTK 1.0
|
||||
* Entry should have a password mode (and it should show stars
|
||||
for user feedback).
|
||||
|
||||
* Entry should allow set_usize to work better, and should compute
|
||||
a different width when a maximum length is used.
|
||||
|
||||
* More dialogs: Print, GtkFontSelector, maybe others...
|
||||
|
||||
* Multiple document interface (MDI)?
|
||||
@@ -155,11 +138,80 @@ TODO AFTER GTK 1.0
|
||||
( You'd have to extend gdk_window_set_hints to accept the
|
||||
window gravity option to get it right. )
|
||||
|
||||
* Text/Edit widget: (some of these might be bugs that should be fixed now)
|
||||
? Allow moving the separator for paned widgets by dragging
|
||||
it directly instead of using the handle.
|
||||
|
||||
? Mark public use of gtk_tree_remove_item as deprecated - it should be used
|
||||
as:
|
||||
gtk_container_remove (GTK_CONTAINER(tree), widget);
|
||||
|
||||
* Standardize that all strings should be passed as gchar *, not
|
||||
guchar *. But what about non-string data? (gdk_property_change,
|
||||
gtk_selection_data_set) X makes these sort of things guchar...
|
||||
|
||||
* Check into XAddConnectionWatch - is this needed for XIM?
|
||||
|
||||
* Places where a _full variant is needed:
|
||||
|
||||
gtk_clist_set_row_data
|
||||
gtk_init_add
|
||||
gtk_menu_popup
|
||||
gtk_toolbar_prepend_element
|
||||
gtk_toolbar_insert_element
|
||||
gtk_widget_dnd_data_set (should be guchar * with a copy?
|
||||
shouldn't be there at all...)
|
||||
??? GtkDrawingarea.draw_data
|
||||
|
||||
* gtk_rc_add_[name/class]_style are broken for bg pixmaps, because
|
||||
styles are broken for bg pixmaps, and RC styles only hack around
|
||||
that.
|
||||
|
||||
* Try to rationally deal with someone else deleting one of our
|
||||
windows??? This would mean keeping track of our window heirarchy
|
||||
ourselves, for one thing, and will never be safe, because of
|
||||
race conditions.
|
||||
|
||||
* --g-fatal-warnings flag that does
|
||||
g_set_warning_handler ((GWarningHandler)g_error);
|
||||
|
||||
* If a window spontaneously resizes itself N times before any
|
||||
ConfigureNotify events are received, then due to the interaction
|
||||
of the ConfigureNotify compression code in GDK and the resize
|
||||
count used for the window, the window will be size_allocated
|
||||
the next N-1 times it is moved.
|
||||
|
||||
Fix: Only send GDK_EVENT_CONFIGURE when the window is resized,
|
||||
create a new event type for toplevel motion. (GDK_EVENT_REPOSITION?)
|
||||
and eliminate the resize count in GtkWindow.
|
||||
|
||||
* Generic ScrolledWindow interface, which provide automatic scrollbar
|
||||
capability to Viewport, Text, and CList widgets.
|
||||
|
||||
GTK_POLICY_NEVER for scrolled windows.
|
||||
|
||||
* Consider caching more state in GdkWindowPrivate. Currently,
|
||||
every widget realization involves a XGetGeometry and a
|
||||
XGetWindowAttributes. And every GdkWindow destruction
|
||||
involves a XQueryTree.
|
||||
|
||||
* Scrolled windows need to be smarter about when they size-request/allocate
|
||||
their children. In particular, we should not be queuing the resizes
|
||||
on the toplevel window, but on the Viewport.
|
||||
|
||||
* Should all the default handlers really return FALSE? This can
|
||||
cause confusing presses to be sent to containers that actually
|
||||
want to get events on themselves.
|
||||
|
||||
* Fix block_resize, disable_resize.
|
||||
|
||||
* Buttons's should derive from Bin's. (GTK 2.0 change, breaks
|
||||
lots of stuff)
|
||||
|
||||
Text/Edit widget:
|
||||
|
||||
Bugs:
|
||||
|
||||
- Who knows?
|
||||
- Really big font (150 pt), plus lots of editing caused segfault
|
||||
|
||||
Improvements:
|
||||
|
||||
@@ -200,30 +252,29 @@ TODO AFTER GTK 1.0
|
||||
appearance on exposes. But this would require using another
|
||||
window to get the origins.
|
||||
|
||||
? Allow moving the separator for paned widgets by dragging
|
||||
it directly instead of using the handle.
|
||||
- In word wrap mode, break:
|
||||
|
||||
? Mark public use of gtk_tree_remove_item as deprecated - it should be used
|
||||
as:
|
||||
gtk_container_remove (GTK_CONTAINER(tree), widget);
|
||||
aaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
|
||||
* Standardize that all strings should be passed as gchar *, not
|
||||
guchar *. But what about non-string data? (gdk_property_change,
|
||||
gtk_selection_data_set) X makes these sort of things guchar...
|
||||
as:
|
||||
| Maximum column
|
||||
aaaaaaaaaaa bbbbbbbbbbb|
|
||||
bbbbbbbbbbbbbbbbbbbbbbb|
|
||||
bbbbbbbbb |
|
||||
|
||||
* Check into XAddConnectionWatch - is this needed for XIM?
|
||||
Instead of:
|
||||
|
|
||||
aaaaaaaaaaa |
|
||||
bbbbbbbbbbbbbbbbbbbbbbb|
|
||||
bbbbbbbbbbbbbbbbbbbb |
|
||||
|
||||
* Places where a _full variant is needed:
|
||||
- Blinking cursor
|
||||
|
||||
- API's : gtk_text_clear, gtk_text_delete_lines (gint start, gint end),
|
||||
gtk_text_append/prepend, gtk_text_insert_at (gint row, gint column),
|
||||
some function to get the row/column from the x/y-coordinates of a
|
||||
mouse click, some function to get the word/line under the mouse pointer
|
||||
[ From: Stefan Jeske <jeske@braunschweig.netsurf.de> ]
|
||||
|
||||
- "changed" emitted when doing deletes on empty Text widget.
|
||||
|
||||
gtk_clist_set_row_data
|
||||
gtk_init_add
|
||||
gtk_menu_popup
|
||||
gtk_toolbar_prepend_element
|
||||
gtk_toolbar_insert_element
|
||||
gtk_widget_dnd_data_set (should be guchar * with a copy?
|
||||
shouldn't be there at all...)
|
||||
??? GtkDrawingarea.draw_data
|
||||
|
||||
* gtk_rc_add_[name/class]_style are broken for bg pixmaps, because
|
||||
styles are broken for bg pixmaps, and RC styles only hack around
|
||||
that.
|
||||
|
||||
11
acconfig.h
11
acconfig.h
@@ -17,10 +17,14 @@
|
||||
/* Other stuff */
|
||||
#undef HAVE_IPC_H
|
||||
#undef HAVE_SHM_H
|
||||
#undef HAVE_XPM
|
||||
#undef HAVE_XSHM_H
|
||||
#undef HAVE_SHAPE_EXT
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
/* some systems do not allow to ipcrm pages prior to
|
||||
* actual usage, namely: OSF1 V3.2, SunOS 4.1.1, 5.5, 5.5.1, 5.6,
|
||||
* IRIX 5.2 and 6.2.
|
||||
*/
|
||||
#undef IPC_RMID_DEFERRED_RELEASE
|
||||
|
||||
#undef NO_FD_SET
|
||||
@@ -31,11 +35,6 @@
|
||||
#undef XINPUT_GXI
|
||||
#undef XINPUT_XFREE
|
||||
|
||||
#undef GTK_MAJOR_VERSION
|
||||
#undef GTK_MINOR_VERSION
|
||||
#undef GTK_MICRO_VERSION
|
||||
#undef GTK_VERSION
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
|
||||
14
config.h.in
14
config.h.in
@@ -6,9 +6,6 @@
|
||||
/* Define if you have a working `mmap' system call. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define as __inline if that's what the C compiler calls it. */
|
||||
#undef inline
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
@@ -21,10 +18,14 @@
|
||||
/* Other stuff */
|
||||
#undef HAVE_IPC_H
|
||||
#undef HAVE_SHM_H
|
||||
#undef HAVE_XPM
|
||||
#undef HAVE_XSHM_H
|
||||
#undef HAVE_SHAPE_EXT
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
/* some systems do not allow to ipcrm pages prior to
|
||||
* actual usage, namely: OSF1 V3.2, SunOS 4.1.1, 5.5, 5.5.1, 5.6,
|
||||
* IRIX 5.2 and 6.2.
|
||||
*/
|
||||
#undef IPC_RMID_DEFERRED_RELEASE
|
||||
|
||||
#undef NO_FD_SET
|
||||
@@ -35,11 +36,6 @@
|
||||
#undef XINPUT_GXI
|
||||
#undef XINPUT_XFREE
|
||||
|
||||
#undef GTK_MAJOR_VERSION
|
||||
#undef GTK_MINOR_VERSION
|
||||
#undef GTK_MICRO_VERSION
|
||||
#undef GTK_VERSION
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
|
||||
66
configure.in
66
configure.in
@@ -4,9 +4,9 @@ AC_INIT(gdk/gdktypes.h)
|
||||
# Save this value here, since automake will set cflags later
|
||||
cflags_set=${CFLAGS+set}
|
||||
|
||||
GTK_MAJOR_VERSION=0
|
||||
GTK_MINOR_VERSION=99
|
||||
GTK_MICRO_VERSION=5
|
||||
GTK_MAJOR_VERSION=1
|
||||
GTK_MINOR_VERSION=0
|
||||
GTK_MICRO_VERSION=4
|
||||
GTK_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$GTK_MICRO_VERSION
|
||||
|
||||
# For automake.
|
||||
@@ -16,12 +16,17 @@ PACKAGE=gtk+
|
||||
# Configure glib
|
||||
AC_CONFIG_SUBDIRS(glib)
|
||||
|
||||
# Save this value here, since automake will set cflags later
|
||||
cflags_set=${CFLAGS+set}
|
||||
|
||||
dnl Initialize automake stuff
|
||||
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
|
||||
|
||||
AC_SUBST(GTK_MAJOR_VERSION)
|
||||
AC_SUBST(GTK_MINOR_VERSION)
|
||||
AC_SUBST(GTK_MICRO_VERSION)
|
||||
AC_SUBST(GTK_VERSION)
|
||||
|
||||
# Save this value here, since automake will set cflags later
|
||||
cflags_set=${CFLAGS+set}
|
||||
|
||||
# Specify a configuration file
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
@@ -45,7 +50,7 @@ AC_ARG_WITH(locale, [ --with-locale=LOCALE locale name you want to use ])
|
||||
AC_ARG_WITH(xinput, [ --with-xinput=[no/gxi/xfree] support XInput ])
|
||||
|
||||
if test "x$enable_debug" = "xyes"; then
|
||||
test "$cflags_set" = set || CFLAGS="-g"
|
||||
test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
|
||||
CFLAGS="$CFLAGS -DG_ENABLE_DEBUG"
|
||||
else
|
||||
if test "x$enable_debug" = "xno"; then
|
||||
@@ -84,15 +89,16 @@ if test "x$enable_xim" = "xyes"; then
|
||||
CFLAGS="$CFLAGS -DUSE_XIM"
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(GTK_MAJOR_VERSION, $GTK_MAJOR_VERSION)
|
||||
AC_DEFINE_UNQUOTED(GTK_MINOR_VERSION, $GTK_MINOR_VERSION)
|
||||
AC_DEFINE_UNQUOTED(GTK_MICRO_VERSION, $GTK_MICRO_VERSION)
|
||||
AC_DEFINE_UNQUOTED(GTK_VERSION, "$GTK_VERSION")
|
||||
|
||||
# Find the X11 include and library directories
|
||||
AC_PATH_X
|
||||
AC_PATH_XTRA
|
||||
|
||||
if test "x$no_x" = "xyes"; then
|
||||
AC_MSG_ERROR([
|
||||
*** X libraries or include files not found. Check 'config.log' for
|
||||
*** more details.])
|
||||
fi
|
||||
|
||||
if test "x$x_includes" = "x"; then
|
||||
x_includes="/usr/include"
|
||||
fi
|
||||
@@ -100,18 +106,34 @@ fi
|
||||
saved_cflags="$CFLAGS"
|
||||
saved_ldflags="$LDFLAGS"
|
||||
|
||||
CFLAGS="$X_CFLAGS"
|
||||
LDFLAGS="$X_LDFLAGS $X_LIBS"
|
||||
CFLAGS="$CFLAGS $X_CFLAGS"
|
||||
LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
|
||||
|
||||
# Checks for libraries.
|
||||
# Check for the X11 library
|
||||
AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", no_x11_lib=yes, $X_EXTRA_LIBS)
|
||||
AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS",
|
||||
AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.]),
|
||||
$X_EXTRA_LIBS)
|
||||
|
||||
if test "x$enable_shm" = "xyes"; then
|
||||
# Check for the Xext library (needed for XShm extention)
|
||||
AC_CHECK_LIB(Xext, XShmAttach, x_libs="-lXext $x_libs", no_xext_lib=yes, $x_libs)
|
||||
AC_CHECK_LIB(Xext, XShmAttach,
|
||||
x_libs="-lXext $x_libs",
|
||||
# On AIX, it is in XextSam instead, but we still need -lXext
|
||||
AC_CHECK_LIB(XextSam, XShmAttach,
|
||||
x_libs="-lXextSam -lXext $x_libs",
|
||||
no_xext_lib=yes, $x_libs),
|
||||
$x_libs)
|
||||
fi
|
||||
|
||||
# Check for shaped window extension
|
||||
|
||||
AC_CHECK_LIB(Xext, XShapeCombineMask,
|
||||
if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
|
||||
x_libs="-lXext $x_libs"
|
||||
fi
|
||||
AC_DEFINE(HAVE_SHAPE_EXT),, $x_libs)
|
||||
|
||||
x_cflags="$X_CFLAGS"
|
||||
x_ldflags="$X_LDFLAGS $X_LIBS"
|
||||
|
||||
@@ -128,7 +150,6 @@ else
|
||||
AC_DEFINE(XINPUT_NONE)
|
||||
fi
|
||||
|
||||
|
||||
AC_SUBST(x_cflags)
|
||||
AC_SUBST(x_includes)
|
||||
AC_SUBST(x_ldflags)
|
||||
@@ -238,7 +259,6 @@ AC_HEADER_STDC
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_C_INLINE
|
||||
|
||||
# Checks for library functions.
|
||||
AC_TYPE_SIGNAL
|
||||
@@ -260,4 +280,12 @@ if test $gtk_ok = no; then
|
||||
AC_DEFINE(NO_FD_SET)
|
||||
fi
|
||||
|
||||
AC_OUTPUT(Makefile gtk+.xconfig docs/Makefile gdk/Makefile gtk/Makefile)
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
gtk-config
|
||||
docs/Makefile
|
||||
gdk/Makefile
|
||||
gtk/Makefile
|
||||
gtk/gtkfeatures.h
|
||||
],
|
||||
[chmod +x gtk-config])
|
||||
|
||||
18
debian/README.debian
vendored
Normal file
18
debian/README.debian
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
libgtk1 for Debian
|
||||
----------------------
|
||||
|
||||
The GIMP Tool Kit (gtk) is a set of widgets to help you program
|
||||
programs for the X Windowing System easily and powerfully.
|
||||
|
||||
gtk is the moving force behind The GNU Image Manipulation Program (The
|
||||
GIMP) -- the number one freely-available image editing and creation
|
||||
program available.
|
||||
|
||||
gtk is rapidly under development, and the source tree has officially
|
||||
been separated from The GIMP now, as other teams of programmers
|
||||
are beginning to write software using its great widget set -- like
|
||||
GNOME, a desktop interface for X, and gzilla, a freely available
|
||||
web browser for X.
|
||||
|
||||
Ben Gertzfield <che@debian.org>, Mon, 29 Sep 1997 13:11:45 -0700
|
||||
|
||||
169
debian/changelog
vendored
Normal file
169
debian/changelog
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
gtk+ (1:0.99.8-1) unstable; urgency=low
|
||||
|
||||
* New upstream version.
|
||||
* New file included in libgtk-dev: /usr/share/aclocal/gtk.m4,
|
||||
to help autoconf/automake developers use gtk and gtk-config
|
||||
more easily.
|
||||
* New file included in libgtk-doc: /usr/doc/libgtk-doc/gtk-config.txt
|
||||
Please refer to this doc when developing for gtk or compiling
|
||||
and running into odd path-related errors.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Thu, 19 Mar 1998 19:58:53 -0800
|
||||
|
||||
gtk+ (1:0.99.7-4) frozen unstable; urgency=low
|
||||
|
||||
* Rebuild with native Debian libtool to have libraries properly
|
||||
linked with libc and libX et al.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Tue, 17 Mar 1998 16:05:13 -0800
|
||||
|
||||
gtk+ (1:0.99.7-3) frozen unstable; urgency=low
|
||||
|
||||
* Accidentally included all the html docs in /usr/doc/libgtk-doc/faq-html;
|
||||
moved the tutorial into /usr/doc/libgtk-doc/tutorial-html.
|
||||
* Included the Italian Gtk+ Tutorial in
|
||||
/usr/doc/libgtk-doc/italian-tutorial-html.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Mon, 16 Mar 1998 22:39:57 -0800
|
||||
|
||||
gtk+ (1:0.99.7-2) unstable; urgency=low
|
||||
|
||||
* Upstream source added a /usr/lib/glib/ directory that I didn't
|
||||
notice; included this directory in libgtk-dev.
|
||||
* Realized that Xinput support was broken because I was doing
|
||||
./configure --enable-xinput=xfree instead of ./configure
|
||||
--with-xinput=xfree. Fixed.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Sun, 15 Mar 1998 19:17:05 -0800
|
||||
|
||||
gtk+ (1:0.99.7-1) unstable; urgency=low
|
||||
|
||||
* New upstream release -- THIS IS INCOMPATIBLE WITH OLDER RELEASES!
|
||||
All Gtk-using packages *will* need patches to work with this Gtk!
|
||||
* Upstream release includes 'gtk-config' script to check installed
|
||||
version of Gtk; included said script in libgtk-dev in /usr/bin.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Sun, 15 Mar 1998 11:03:03 -0800
|
||||
|
||||
gtk+ (1:0.99.5-2) unstable; urgency=low
|
||||
|
||||
* Modified libgtk-doc to Replace: libgtk-dev (<< 1:0.99.4) to
|
||||
deal with both packages including the same .info files.
|
||||
Fixes bug #19533.
|
||||
* Also noticed that libgtk-dev depended on libgtk1 without
|
||||
an epoch! Fixed.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Thu, 12 Mar 1998 13:37:11 -0800
|
||||
|
||||
gtk+ (1:0.99.5-1) unstable; urgency=low
|
||||
|
||||
* Wow, that was quick, a new upstream version.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Mon, 9 Mar 1998 22:08:08 -0800
|
||||
|
||||
gtk+ (1:0.99.4-3) unstable; urgency=low
|
||||
|
||||
* Recompiled with --enable-xinput=xfree to enable Wacom pads
|
||||
and other physical input devices.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Mon, 9 Mar 1998 21:26:07 -0800
|
||||
|
||||
gtk+ (1:0.99.4-2) unstable; urgency=MEDIUM
|
||||
|
||||
* Ack! The shlibs file makes things depend on libgtk1 (>= 0.99.4)
|
||||
rather than (>= 1:0.99.4)! Fixes bug #19134.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Sat, 7 Mar 1998 23:57:33 -0800
|
||||
|
||||
gtk+ (1:0.99.4-1) unstable; urgency=low
|
||||
|
||||
* New upstream version.
|
||||
* Recompiled with new debhelper to remove du warnings.
|
||||
* Upstream source is named gtk+, not libgtk1. Changed source name.
|
||||
* Removed --disable-xim in hopes that xim is no longer broken.
|
||||
* Removed testgtk at the behest of the Gtk developers until I can
|
||||
come up with a better solution, probably related to:
|
||||
* the new libgtk-doc package! :) libgtk-doc contains the Gtk FAQ,
|
||||
the Gtk Tutorial, and the Gtk info files.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Tue, 3 Mar 1998 22:23:47 -0800
|
||||
|
||||
libgtk1 (1:0.99.3-2) unstable; urgency=low
|
||||
|
||||
* Created manpage for testgtk program.
|
||||
* Fixed copyright mention to LGPL.gz to be just LGPL.
|
||||
* This fixes all known lintian errors.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Wed, 11 Feb 1998 14:07:17 -0800
|
||||
|
||||
libgtk1 (1:0.99.3-1) unstable; urgency=low
|
||||
|
||||
* New upstream version.
|
||||
* Include the testgtk binary in libgtk-dev.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Sat, 24 Jan 1998 15:30:09 -0800
|
||||
|
||||
libgtk1 (1:0.99.2-2) unstable; urgency=low
|
||||
|
||||
* Fixed shlibs file to specify version >=1:0.99.2.
|
||||
* Renamed debian/postinst.libgtk1 to debian/postinst, so debhelper
|
||||
would actually install it.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Mon, 5 Jan 1998 12:22:46 -0800
|
||||
|
||||
libgtk1 (1:0.99.2-1) unstable; urgency=low
|
||||
|
||||
* New upstream version.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Sun, 4 Jan 1998 00:21:21 -0800
|
||||
|
||||
libgtk1 (1:0.99.0-1) unstable; urgency=medium
|
||||
|
||||
* New upstream version with new numbering scheme, went to epoch :1
|
||||
correspondingly.
|
||||
* Hopefully fixed entry-field bug.
|
||||
* Converted to use debhelper.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Mon, 15 Dec 1997 12:02:25 -0800
|
||||
|
||||
libgtk1 (971201-1) unstable; urgency=low
|
||||
|
||||
* New upstream version.
|
||||
* Fixed copyright to say LGPL, not GPL. (bug #14867)
|
||||
* Re-added postinst ldconfig call. (bug #14213)
|
||||
* Info files should be correct now. (bugs #14773, #15143)
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Mon, 1 Dec 1997 16:41:50 -0800
|
||||
|
||||
libgtk1 (971109-1) unstable; urgency=low
|
||||
|
||||
* New upstream version.
|
||||
* Name is really 'GIMP Tool Kit', not 'General Tool Kit'.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Mon, 10 Nov 1997 16:15:27 -0800
|
||||
|
||||
libgtk1 (970925-3) unstable; urgency=low
|
||||
|
||||
* Moved the include files to /usr/include/{gtk,gdk}.
|
||||
* Removed postinst/postrm ldconfig calls, fixes old gimp bug #13773.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Fri, 17 Oct 1997 17:06:10 -0700
|
||||
|
||||
libgtk1 (970925-2) unstable; urgency=low
|
||||
|
||||
* Added the shlibs file.
|
||||
* Removed the postinst/postrm calls to ldconfig, fixes bug #13733.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Fri, 10 Oct 1997 17:55:39 -0700
|
||||
|
||||
libgtk1 (970925-1) unstable; urgency=low
|
||||
|
||||
* New upstream version.
|
||||
* Split off source tree from gimp's source tree.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Mon, 29 Sep 1997 13:14:45 -0700
|
||||
|
||||
Local variables:
|
||||
mode: debian-changelog
|
||||
add-log-mailing-address: "che@debian.org"
|
||||
End:
|
||||
41
debian/control
vendored
Normal file
41
debian/control
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
Source: gtk+
|
||||
Priority: optional
|
||||
Section: libs
|
||||
Maintainer: Ben Gertzfield <che@debian.org>
|
||||
Standards-Version: 2.4.0.0
|
||||
|
||||
Package: libgtk1
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends}
|
||||
Description: The GIMP Toolkit set of widgets for X
|
||||
The GIMP Toolkit is a freely available set of widgets for X.
|
||||
GTK is easy to use, and has been implemented in such projects as
|
||||
The GNU Image Manipulation Program (The GIMP), GNOME, a GNU
|
||||
desktop set of utilities for X, and gzilla, a GNU web-browser.
|
||||
|
||||
Package: libgtk-dev
|
||||
Architecture: any
|
||||
Section: devel
|
||||
Depends: libgtk1 (>= 1:0.99.8)
|
||||
Suggests: libgtk-doc
|
||||
Replaces: libgtk1 (<= 0.99.7)
|
||||
Description: Header files and static libraries for the GIMP Toolkit
|
||||
This package contains the header files and static libraries for the
|
||||
GIMP Toolkit set of widgets for X.
|
||||
.
|
||||
Install this package if you wish to develop your own X programs using
|
||||
the GIMP Toolkit, or if you wish to compile your own plug-ins for
|
||||
The GIMP.
|
||||
|
||||
Package: libgtk-doc
|
||||
Architecture: all
|
||||
Section: docs
|
||||
Replaces: libgtk-dev (<< 1:0.99.4)
|
||||
Description: Documentation and example code for the GIMP Toolkit
|
||||
This package contains lots of info-files, HTML docs, FAQs, and
|
||||
other handy documentation about the GIMP Toolkit set of widgets
|
||||
for X.
|
||||
.
|
||||
Install this package if you want to have lots of info about the
|
||||
GIMP toolkit when you're programming.
|
||||
8
debian/copyright
vendored
Normal file
8
debian/copyright
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
This package was debianized by Ben Gertzfield che@imsa.edu on
|
||||
Tue, 22 Jul 1997 20:53:20 -0500
|
||||
|
||||
It was downloaded from ftp.gimp.org.
|
||||
|
||||
It may be redistributed under the terms of the GNU LGPL, Version 2 or
|
||||
later, found on Debian systems in the file /usr/doc/copyright/LGPL.
|
||||
|
||||
7
debian/libgtk-dev.postinst
vendored
Normal file
7
debian/libgtk-dev.postinst
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
ldconfig
|
||||
|
||||
#DEBHELPER#
|
||||
6
debian/libgtk-dev.prerm
vendored
Normal file
6
debian/libgtk-dev.prerm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
install-info --quiet --remove gtk
|
||||
|
||||
#DEBHELPER#
|
||||
14
debian/libgtk-doc.postinst
vendored
Normal file
14
debian/libgtk-doc.postinst
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
install-info --quiet --description="The GIMP Toolkit." \
|
||||
--section "The GIMP" "The GIMP" /usr/info/gtk.info.gz
|
||||
|
||||
install-info --quiet --description="The GIMP Drawing Kit." \
|
||||
--section "The GIMP" "The GIMP" /usr/info/gdk.info.gz
|
||||
|
||||
install-info --quiet --description="The GIMP Library." \
|
||||
--section "The GIMP" "The GIMP" /usr/info/glib.info.gz
|
||||
|
||||
#DEBHELPER#
|
||||
8
debian/libgtk-doc.prerm
vendored
Normal file
8
debian/libgtk-doc.prerm
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
install-info --quiet --remove gtk
|
||||
install-info --quiet --remove glib
|
||||
install-info --quiet --remove gdk
|
||||
|
||||
#DEBHELPER#
|
||||
7
debian/postinst
vendored
Normal file
7
debian/postinst
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
ldconfig
|
||||
|
||||
#DEBHELPER#
|
||||
120
debian/rules
vendored
Executable file
120
debian/rules
vendored
Executable file
@@ -0,0 +1,120 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
build: build-stamp
|
||||
build-stamp:
|
||||
dh_testdir
|
||||
# Add here commands to compile the package.
|
||||
./configure --prefix=/usr --with-xinput=xfree
|
||||
$(MAKE)
|
||||
cd docs && make -f Makefile.sgml
|
||||
cd ..
|
||||
touch build-stamp
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp
|
||||
# Add here commands to clean up after the build process.
|
||||
-$(MAKE) distclean
|
||||
-rm docs/*.html
|
||||
dh_clean
|
||||
|
||||
install: install-stamp
|
||||
install-stamp: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean
|
||||
$(MAKE) prefix=`pwd`/debian/tmp/usr install
|
||||
touch install-stamp
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install libgtk-doc
|
||||
# We have nothing to do by default.
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install libgtk-dev libgtk1
|
||||
|
||||
libgtk1: build
|
||||
dh_testdir -plibgtk1
|
||||
dh_testroot -plibgtk1
|
||||
# dh_clean -plibgtk1
|
||||
dh_installdirs -plibgtk1
|
||||
# Add here commands to install the files into debian/tmp
|
||||
rm -rf debian/tmp/usr/bin debian/tmp/usr/include debian/tmp/usr/info debian/tmp/usr/lib/glib debian/tmp/usr/share
|
||||
# dh_movefiles -plibgtk1
|
||||
# $(MAKE) prefix=`pwd`/debian/tmp/usr install
|
||||
# rmdir debian/tmp/usr/bin
|
||||
# rm debian/tmp/usr/lib/*.{so,la,a}
|
||||
# rm -rf debian/tmp/usr/{include,info}
|
||||
dh_installdocs -plibgtk1
|
||||
dh_installchangelogs -plibgtk1
|
||||
dh_strip -plibgtk1
|
||||
dh_compress -plibgtk1
|
||||
dh_fixperms -plibgtk1
|
||||
dh_installdeb -plibgtk1
|
||||
dh_shlibdeps -plibgtk1
|
||||
dh_gencontrol -plibgtk1
|
||||
dh_makeshlibs -plibgtk1 -V 'libgtk1 (>= 1:0.99.7)'
|
||||
# echo "libglib 1 libgtk1 (>=0.99.4)" >> debian/tmp/DEBIAN/shlibs
|
||||
# echo "libgtk 1 libgtk1 (>=0.99.4)" >> debian/tmp/DEBIAN/shlibs
|
||||
# echo "libgdk 1 libgtk1 (>=0.99.4)" >> debian/tmp/DEBIAN/shlibs
|
||||
dh_md5sums -plibgtk1
|
||||
dh_builddeb -plibgtk1
|
||||
|
||||
libgtk-dev: build
|
||||
dh_testdir -plibgtk-dev
|
||||
dh_testroot -plibgtk-dev
|
||||
dh_clean -plibgtk-dev -k
|
||||
dh_installdirs -plibgtk-dev
|
||||
# Add here commands to install the files into debian/tmp
|
||||
dh_movefiles -plibgtk-dev
|
||||
cp gtk-config debian/tmp/usr/bin
|
||||
# $(MAKE) prefix=`pwd`/debian/libgtk-dev/usr install
|
||||
# find debian/libgtk-dev/usr/lib \( -type f -or -type l \) -and ! \( -name \*.so -or -name \*.a \) | xargs rm
|
||||
# cp gtk/.libs/testgtk debian/libgtk-dev/usr/bin
|
||||
# cp debian/testgtk.1 debian/libgtk-dev/usr/man/man1
|
||||
dh_installdocs -plibgtk-dev
|
||||
dh_installchangelogs -plibgtk-dev
|
||||
dh_strip -plibgtk-dev
|
||||
dh_compress -plibgtk-dev
|
||||
dh_fixperms -plibgtk-dev
|
||||
dh_installdeb -plibgtk-dev
|
||||
dh_shlibdeps -plibgtk-dev
|
||||
dh_gencontrol -plibgtk-dev
|
||||
dh_makeshlibs -plibgtk-dev
|
||||
dh_md5sums -plibgtk-dev
|
||||
dh_builddeb -plibgtk-dev
|
||||
|
||||
libgtk-doc:
|
||||
dh_testdir -plibgtk-doc
|
||||
dh_testroot -plibgtk-doc
|
||||
dh_clean -plibgtk-doc -k
|
||||
dh_installdirs -plibgtk-doc usr/doc/libgtk-doc/faq-html \
|
||||
usr/doc/libgtk-doc/tutorial-html usr/doc/libgtk-doc/italian-tutorial-html
|
||||
# Add here commands to install the files into debian/tmp
|
||||
dh_movefiles -plibgtk-doc
|
||||
cp docs/gtkfaq*.html debian/libgtk-doc/usr/doc/libgtk-doc/faq-html
|
||||
cp docs/gtk_tut-*.html debian/libgtk-doc/usr/doc/libgtk-doc/tutorial-html
|
||||
cp docs/gtk_tut.html debian/libgtk-doc/usr/doc/libgtk-doc/tutorial-html
|
||||
cp docs/gtk_tut_it*.html debian/libgtk-doc/usr/doc/libgtk-doc/italian-tutorial-html
|
||||
dh_installdocs -plibgtk-doc docs/{debugging,developers,styles,text_widget,widget_system,gtk-config}.txt ChangeLog TODO NEWS
|
||||
dh_installchangelogs -plibgtk-doc
|
||||
dh_strip -plibgtk-doc
|
||||
dh_compress -plibgtk-doc
|
||||
dh_fixperms -plibgtk-doc
|
||||
dh_installdeb -plibgtk-doc
|
||||
dh_shlibdeps -plibgtk-doc
|
||||
dh_gencontrol -plibgtk-doc
|
||||
dh_makeshlibs -plibgtk-doc
|
||||
dh_md5sums -plibgtk-doc
|
||||
dh_builddeb -plibgtk-doc
|
||||
|
||||
|
||||
source diff:
|
||||
@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary
|
||||
@@ -1,5 +1,6 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
*.html
|
||||
*.info*
|
||||
*.dvi
|
||||
*.ps
|
||||
|
||||
@@ -2,18 +2,28 @@
|
||||
|
||||
info_TEXINFOS = gdk.texi gtk.texi glib.texi
|
||||
|
||||
man_MANS = gtk-config.1
|
||||
|
||||
EXTRA_DIST = \
|
||||
texinfo.tex \
|
||||
macros.texi \
|
||||
Makefile.gtkfaq \
|
||||
gtkfaq.sgml \
|
||||
gtkfaq_fix \
|
||||
debugging.txt \
|
||||
developers.txt \
|
||||
refcounting.txt \
|
||||
styles.txt \
|
||||
text_widget.txt \
|
||||
widget_system.txt
|
||||
texinfo.tex \
|
||||
macros.texi \
|
||||
Makefile.sgml \
|
||||
gtkdocs_fix \
|
||||
gtkfaq.sgml \
|
||||
gtk-config.txt \
|
||||
gtk_tut.sgml \
|
||||
gtk_tut_it.sgml \
|
||||
debugging.txt \
|
||||
developers.txt \
|
||||
refcounting.txt \
|
||||
styles.txt \
|
||||
text_widget.txt \
|
||||
widget_system.txt \
|
||||
gtk_tut_packbox1.gif \
|
||||
gtk_tut_packbox2.gif \
|
||||
gtk_tut_table.gif \
|
||||
gtk-config.1
|
||||
|
||||
|
||||
|
||||
files:
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
#
|
||||
# To use this makefile, do:
|
||||
# make -f Makefile.gtkfaq
|
||||
#
|
||||
# This is not done by default because you might
|
||||
# not have sgml2html installed... Perhaps we could
|
||||
# detect that in the future and combine it in with
|
||||
# the automake stuff...
|
||||
#
|
||||
|
||||
all: sgml
|
||||
|
||||
sgml:
|
||||
sgml2html gtkfaq.sgml
|
||||
cp gtkfaq.html index.html
|
||||
perl gtkfaq_fix *.html
|
||||
294
docs/Makefile.in
294
docs/Makefile.in
@@ -1,294 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.2c from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = true
|
||||
PRE_INSTALL = true
|
||||
POST_INSTALL = true
|
||||
NORMAL_UNINSTALL = true
|
||||
PRE_UNINSTALL = true
|
||||
POST_UNINSTALL = true
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NM = @NM@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
VERSION = @VERSION@
|
||||
x_cflags = @x_cflags@
|
||||
x_includes = @x_includes@
|
||||
x_ldflags = @x_ldflags@
|
||||
x_libs = @x_libs@
|
||||
xinput_progs = @xinput_progs@
|
||||
|
||||
info_TEXINFOS = gdk.texi gtk.texi
|
||||
|
||||
EXTRA_DIST = texinfo.tex macros.texi Makefile.gtkfaq gtkfaq.sgml gtkfaq_fix
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
TEXI2DVI = texi2dvi
|
||||
TEXINFO_TEX = $(srcdir)/texinfo.tex
|
||||
INFO_DEPS = gdk.info gtk.info
|
||||
DVIS = gdk.dvi gtk.dvi
|
||||
TEXINFOS = gdk.texi gtk.texi
|
||||
DIST_COMMON = Makefile.am Makefile.in texinfo.tex
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .dvi .info .ps .texi .texinfo
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
gdk.info: gdk.texi
|
||||
gdk.dvi: gdk.texi
|
||||
|
||||
|
||||
gtk.info: gtk.texi
|
||||
gtk.dvi: gtk.texi
|
||||
|
||||
|
||||
DVIPS = dvips
|
||||
|
||||
.texi.info:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texi.dvi:
|
||||
TEXINPUTS=$(srcdir):$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.texi:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo.info:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo.dvi:
|
||||
TEXINPUTS=$(srcdir):$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
.dvi.ps:
|
||||
$(DVIPS) $< -o $@
|
||||
|
||||
install-info-am: $(INFO_DEPS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(infodir)
|
||||
@for file in $(INFO_DEPS); do \
|
||||
d=$(srcdir); \
|
||||
for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
|
||||
if test -f $$d/$$ifile; then \
|
||||
echo " $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile"; \
|
||||
$(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile; \
|
||||
else : ; fi; \
|
||||
done; \
|
||||
done
|
||||
@$(POST_INSTALL)
|
||||
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
|
||||
for file in $(INFO_DEPS); do \
|
||||
echo " install-info --info-dir=$(infodir) $(infodir)/$$file";\
|
||||
install-info --info-dir=$(infodir) $(infodir)/$$file || :;\
|
||||
done; \
|
||||
else : ; fi
|
||||
|
||||
uninstall-info:
|
||||
$(PRE_UNINSTALL)
|
||||
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
|
||||
ii=yes; \
|
||||
else ii=; fi; \
|
||||
for file in $(INFO_DEPS); do \
|
||||
test -z $ii || install-info --info-dir=$(infodir) --remove $$file; \
|
||||
done
|
||||
$(NORMAL_UNINSTALL)
|
||||
for file in $(INFO_DEPS); do \
|
||||
(cd $(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
|
||||
done
|
||||
|
||||
dist-info: $(INFO_DEPS)
|
||||
for base in $(INFO_DEPS); do \
|
||||
d=$(srcdir); \
|
||||
for file in `cd $$d && eval echo $$base*`; do \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done; \
|
||||
done
|
||||
|
||||
mostlyclean-aminfo:
|
||||
-rm -f gdk.aux gdk.cp gdk.cps gdk.dvi gdk.fn gdk.fns gdk.ky gdk.kys \
|
||||
gdk.ps gdk.log gdk.pg gdk.toc gdk.tp gdk.tps gdk.vr gdk.vrs \
|
||||
gdk.op gdk.tr gdk.cv gdk.cn gtk.aux gtk.cp gtk.cps gtk.dvi \
|
||||
gtk.fn gtk.fns gtk.ky gtk.kys gtk.ps gtk.log gtk.pg gtk.toc \
|
||||
gtk.tp gtk.tps gtk.vr gtk.vrs gtk.op gtk.tr gtk.cv gtk.cn
|
||||
|
||||
clean-aminfo:
|
||||
|
||||
distclean-aminfo:
|
||||
|
||||
maintainer-clean-aminfo:
|
||||
for i in $(INFO_DEPS); do \
|
||||
rm -f $$i; \
|
||||
if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \
|
||||
rm -f $$i-[0-9]*; \
|
||||
fi; \
|
||||
done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = docs
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu docs/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
$(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
|
||||
info: $(INFO_DEPS)
|
||||
dvi: $(DVIS)
|
||||
check: all
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
install-exec:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data: install-info-am
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall: uninstall-info
|
||||
|
||||
all: Makefile $(INFO_DEPS)
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(infodir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-aminfo mostlyclean-generic
|
||||
|
||||
clean: clean-aminfo clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-aminfo distclean-generic clean
|
||||
-rm -f config.status
|
||||
-rm -f libtool
|
||||
|
||||
maintainer-clean: maintainer-clean-aminfo maintainer-clean-generic \
|
||||
distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: default install-info-am uninstall-info mostlyclean-aminfo \
|
||||
distclean-aminfo clean-aminfo maintainer-clean-aminfo tags distdir info \
|
||||
dvi installcheck install-exec install-data install uninstall all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
40
docs/Makefile.sgml
Normal file
40
docs/Makefile.sgml
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# To use this makefile, do:
|
||||
# make -f Makefile.gtkfaq
|
||||
#
|
||||
# This is not done by default because you might
|
||||
# not have sgml2html installed... Perhaps we could
|
||||
# detect that in the future and combine it in with
|
||||
# the automake stuff...
|
||||
#
|
||||
|
||||
all: html ps
|
||||
|
||||
html: faq tut italian_tut
|
||||
perl gtkdocs_fix gtkfaq*.html gtk_tut*.html
|
||||
|
||||
txt:
|
||||
sgml2txt gtkfaq.sgml
|
||||
sgml2txt gtk_tut.sgml
|
||||
sgml2txt gtk_tut_it.sgml
|
||||
|
||||
ps: dvi
|
||||
dvips -o gtkfaq.ps gtkfaq.dvi
|
||||
dvips -o gtk_tut.ps gtk_tut.dvi
|
||||
dvips -o gtk_tut_it.ps gtk_tut_it.dvi
|
||||
|
||||
dvi:
|
||||
sgml2latex gtkfaq.sgml
|
||||
sgml2latex gtk_tut.sgml
|
||||
sgml2latex gtk_tut_it.sgml
|
||||
|
||||
faq:
|
||||
sgml2html gtkfaq.sgml
|
||||
|
||||
tut:
|
||||
sgml2html gtk_tut.sgml
|
||||
|
||||
italian_tut:
|
||||
sgml2html gtk_tut_it.sgml
|
||||
|
||||
|
||||
@@ -53,11 +53,10 @@ by the:
|
||||
First the environment variables are applied, then the command line
|
||||
options are applied in the order given on the command line.
|
||||
|
||||
Each of these can either be the special value ALL, or a sequence of
|
||||
':' separated options. (Note, case is significant). The environment
|
||||
variables and the --gtk-debug and --gdk-debug options add debugging
|
||||
options and the --gtk-no-debug and --gdk-no-debug options remove
|
||||
them.
|
||||
Each of these can either be the special value 'all', or a sequence of
|
||||
':' separated options. (case is ignored). The environment variables
|
||||
and the --gtk-debug and --gdk-debug options add debugging options and
|
||||
the --gtk-no-debug and --gdk-no-debug options remove them.
|
||||
|
||||
As noted below, some of these are useful in application debugging, but
|
||||
most are only interested to those debugging the libraries
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<!-- NOTE: Use only one author tag, otherwise sgml2txt barfs - TRG -->
|
||||
<author>Nathan Froyd, Tony Gale, Shawn T. Amundson.
|
||||
<date>March 9th 1998
|
||||
<date>May 11th 1998
|
||||
<abstract>
|
||||
This document is intended to answer questions that are likely to be
|
||||
frequently asked by programmers using GTK+ or people who are just
|
||||
@@ -79,19 +79,17 @@ GNU, though."
|
||||
<sect1>Where is the documentation for GTK+?
|
||||
<p>
|
||||
In the GTK+ distribution's doc/ directory you will find the
|
||||
reference material for both GTK and GDK, and this FAQ.
|
||||
reference material for both GTK and GDK, this FAQ and the
|
||||
GTK Tutorial.
|
||||
|
||||
There is also a GTK+ Tutorial which can be found at
|
||||
<htmlurl url="http://www.levien.com/~slow/gtk/"
|
||||
name="http://www.levien.com/~slow/gtk/">.
|
||||
In addition, you can find links to HTML versions of these documents
|
||||
by going to
|
||||
<htmlurl url="http://www.gtk.org/"
|
||||
name="http://www.gtk.org/">.
|
||||
|
||||
The Tutorial and FAQ can also be found at
|
||||
<htmlurl url="http://www.geocities.com/ResearchTriangle/Lab/4299/"
|
||||
name="http://www.geocities.com/ResearchTriangle/Lab/4299/">.
|
||||
|
||||
In addition, you can find links to all of these documents by going to
|
||||
<htmlurl url="http://www.gimp.org/gtk/docs"
|
||||
name="http://www.gimp.org/gtk/docs">.
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>Is there a mailing list (or mailing list archive) for GTK+?
|
||||
@@ -110,7 +108,7 @@ email message to <htmlurl url="mailto:gtk-list-request@redhat.com"
|
||||
name="gtk-list-request@redhat.com">
|
||||
with <em>subscribe</em> in the <bf>subject</bf>.
|
||||
<p>
|
||||
A searchable archive of the mailing list can be found at <htmlurl url="http://www.redhat.com/linux-info/gtk/gtk-list/index.html" name="http://www.redhat.com/linux-info/gtk/gtk-list/index.html">
|
||||
A searchable archive of the mailing list can be found at <htmlurl url="http://archive.redhat.com/gtk-list" name="http://archive.redhat.com/gtk-list">
|
||||
</itemize>
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>The gtk-list hasn't had any traffic for days, is it dead?
|
||||
@@ -165,6 +163,23 @@ name="http://www.gnome.org">)
|
||||
is using GTK+ to build a free desktop for Linux. Many more programs can be found
|
||||
there.
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>I'm looking for an application to write in GTK+. How about an IRC client?
|
||||
<p>
|
||||
|
||||
Ask on gtk-list for suggestions. There are at least four IRC
|
||||
clients already under development.
|
||||
|
||||
<itemize>
|
||||
<item>girc. (Included with GNOME)
|
||||
<item>Bezerk (<htmlurl url="http://www.gtk.org/~trog/"
|
||||
name="http://www.gtk.org/~trog/">)
|
||||
<item>gsirc. (Location?)
|
||||
<item>Gnirc. (<htmlurl url="http://www.imaginet.fr/~dramboz/gnirc"
|
||||
name="http://www.imaginet.fr/~dramboz/gnirc">)
|
||||
</itemize>
|
||||
|
||||
|
||||
<!-- ***************************************************************** -->
|
||||
<sect>How to find, configure, install, and troubleshoot GTK+
|
||||
|
||||
@@ -181,9 +196,9 @@ and associated libraries on your system.
|
||||
<p>
|
||||
The canonical site is:
|
||||
<verb>
|
||||
ftp://ftp.gimp.org/pub/gtk
|
||||
ftp://ftp.gtk.org/pub/gtk
|
||||
</verb>
|
||||
Of course, any mirrors of ftp.gimp.org should have the latest version, too.
|
||||
Of course, any mirrors of ftp.gtk.org should have the latest version, too.
|
||||
|
||||
<sect1>How do I configure/compile GTK+?
|
||||
<p>
|
||||
@@ -204,22 +219,37 @@ handle the automatically generated Makefiles.
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
|
||||
<sect1>I've compiled and installed GTK+, but I can't get any programs to link
|
||||
with it!
|
||||
<sect1>I've compiled and installed GTK+, but I can't get any programs to link with it!
|
||||
<p>
|
||||
This problem is most often encountered when the GTK+ libraries can't be
|
||||
found or are the wrong version. Generally, the compiler will complain about an
|
||||
'unresolved symbol'. There are two things you need to check:
|
||||
<itemize>
|
||||
<item>Make sure that the libraries can be found. You want to edit
|
||||
/etc/ld.so.conf to include /usr/local/lib (or whereever you installed GTK+),
|
||||
/etc/ld.so.conf to include the directories which contain the GTK libraries,
|
||||
so it looks something like:
|
||||
<verb>
|
||||
/usr/X11R6/lib
|
||||
/usr/local/lib
|
||||
</verb>
|
||||
Then you need to run /sbin/ldconfig as root.
|
||||
<p>
|
||||
Then you need to run /sbin/ldconfig as root. You can find what directory
|
||||
GTK is in using
|
||||
<verb>
|
||||
gtk-config --libs
|
||||
</verb>
|
||||
|
||||
If your system doesn't use ld.so to find libraries (such as Solaris), then
|
||||
you will have to use the LD_LIBRARY_PATH environment variable (or compile
|
||||
the path into your program, which I'm not going to cover here). So, with a
|
||||
Bourne type shell you can do (if your GTK libraries are in /usr/local/lib):
|
||||
<verb>
|
||||
export LD_LIBRARY_PATH=/usr/local/lib
|
||||
</verb>
|
||||
and in a csh, you can do:
|
||||
<verb>
|
||||
setenv LD_LIBRARY_PATH /usr/local/lib
|
||||
</verb>
|
||||
|
||||
<item>Make sure the linker is finding the correct set of libraries. If you
|
||||
have a Linux distribution that installs GTK+ (e.g. RedHat 5.0) then this
|
||||
older version may be used. Now (assuming you have a RedHat
|
||||
@@ -235,50 +265,80 @@ the libraries libgtk, libgdk, libglib, or libgck. If they do exist, remove them
|
||||
and reinstall gtk+.
|
||||
</itemize>
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>When compiling programs with GTK+, I get compiler error messages about not being able to find <tt/"glibconfig.h"/.
|
||||
|
||||
<p> The header file "glibconfig.h" was moved to the directory
|
||||
$exec_prefix/lib/glib/include/. $exec_prefix is the
|
||||
directory that was specified by giving the --exec-prefix
|
||||
flags to ./configure when compiling GTK+. It defaults to
|
||||
$prefix, (specified with --prefix), which in turn defaults
|
||||
to /usr/local/.
|
||||
|
||||
This was done because "glibconfig.h" includes architecture
|
||||
dependent information, and the rest of the include files
|
||||
are put in $prefix/include, which can be shared between different
|
||||
architectures.
|
||||
|
||||
GTK+ includes a shell script, <tt/gtk-config/, that
|
||||
makes it easy to find out the correct include paths.
|
||||
The GTK+ tutorial includes an example of using <tt/gtk-config/
|
||||
for simple compilation from the command line. For information
|
||||
about more complicated configuration, see the file
|
||||
docs/gtk-config.txt in the GTK+ distribution.
|
||||
|
||||
If you are trying to compile an old program, you may
|
||||
be able to work around the problem by configuring it
|
||||
with a command line like:
|
||||
|
||||
<tscreen><verb>
|
||||
CPPFLAGS="-I/usr/local/include/glib/include" ./configure
|
||||
</verb></tscreen>
|
||||
|
||||
for Bourne-compatible shells like bash, or for csh variants:
|
||||
|
||||
<tscreen><verb>
|
||||
setenv CPPFLAGS "-I/usr/local/include/glib/include"
|
||||
./configure
|
||||
</verb></tscreen>
|
||||
|
||||
(Substitute the appropriate value of $exec_prefix for /usr/local.)
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>When installing The GIMP, configure reports that it can't find GTK.
|
||||
<p>
|
||||
There are several common reasons for this:
|
||||
<itemize>
|
||||
<item>You have an old version of GTK installed somewhere. RedHat 5.0, for
|
||||
example, installs an older copy of GTK that will not work with the latest
|
||||
versions of GIMP. You should remove this old copy, but note that in the case
|
||||
of RedHat 5.0 this will break the <tt/control-panel/ applications.
|
||||
<P>
|
||||
<item><tt/gtk-config/ (or another component of GTK) isn't in your path, or
|
||||
there is an old version on your system. Type:
|
||||
<verb>
|
||||
gtk-config --version
|
||||
</verb>
|
||||
to check for both of these. This should return a value of at least 0.99.8
|
||||
for things to work properly with GIMP 0.99.23. If it returns a value
|
||||
different from what you expect, then you have an old version of GTK on
|
||||
your system.
|
||||
<P>
|
||||
<item>The ./configure script can't find the GTK libraries. As ./configure
|
||||
compiles various test programs, it needs to be able to find the GTK
|
||||
libraries. See the question above for help on this.
|
||||
</itemize>
|
||||
<p>
|
||||
If none of the above help, then have a look in config.log, which is
|
||||
generated by ./configure as it runs. At the bottom will be the last
|
||||
action it took before failing. If it is a section of source code, copy
|
||||
the source code to a file and compile it with the line just above it in
|
||||
config.log. If the compilation is successful, try executing it.
|
||||
|
||||
<!-- ***************************************************************** -->
|
||||
<sect>Development of GTK+
|
||||
<!-- ***************************************************************** -->
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>When will it reach version 1.0?
|
||||
<p>
|
||||
The file 'TODO' in the gtk+ distribution lists the things that need to be done
|
||||
before version 1.0 is repleased. Not including bugs, this includes:
|
||||
|
||||
<itemize>
|
||||
<item>New Features
|
||||
<itemize>
|
||||
<item>gdk_expose_compress: ala-Xt, this would really help for opaque moves and
|
||||
such
|
||||
</itemize>
|
||||
<p>
|
||||
|
||||
<item>Widgets
|
||||
<itemize>
|
||||
<item>Column-list (Jay Painter)
|
||||
<item>Text widget (needs to be finished)
|
||||
<item>Entry should have a password mode (and it should show stars
|
||||
for user feedback)
|
||||
</itemize>
|
||||
<p>
|
||||
|
||||
<item>Drag-and-Drop (DND)
|
||||
<itemize>
|
||||
<item> It seems to be having problems again. The way DND data types are set in
|
||||
GtkWidget really needs to be fixed. This is pretty high on my priority
|
||||
list, and I'll get to it as soon as the column list widget is done. The
|
||||
correct way dnd data needs to be set is to have a additional keyed data
|
||||
type with GtkWidget, which is applied to the widget's window upon realize.
|
||||
There also needs to be a way to set dnd-data on widget windows which are
|
||||
not the main window (for widgets that create more than one window).
|
||||
-- Jay Painter
|
||||
<item> DnD seems to work for me, but yes, there needs to be some sort of
|
||||
gtk_widget layer that makes it easier... Also, adding support for drop
|
||||
zones might be nice.
|
||||
-- Elliot
|
||||
</itemize>
|
||||
</itemize>
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>Whats this CVS thing that everyone keeps talking about, and how do I access it?
|
||||
<p>
|
||||
@@ -327,7 +387,7 @@ and then generate a patch in the form of a 'context diff'. This can be done
|
||||
using a command such as <tt/diff -ru <oldfile> <newfile>/.
|
||||
Then upload the patchfile to:
|
||||
<verb>
|
||||
ftp://ftp.gimp.org/incoming
|
||||
ftp://ftp.gtk.org/incoming
|
||||
</verb>
|
||||
along with a README file. Make sure you follow the naming conventions or your
|
||||
patch will just be deleted! The filenames should be of this form:
|
||||
@@ -344,12 +404,12 @@ Example:
|
||||
gtk-gale-982701-0.patch.gz
|
||||
gtk-gale-982701-0.patch.README
|
||||
</verb>
|
||||
Once you upload <em>anything</em>, send the README to ftp-admin@gimp.org
|
||||
Once you upload <em>anything</em>, send the README to ftp-admin@gtk.org
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>How do I know if my patch got applied, and if not, why not?
|
||||
<p>
|
||||
Uploaded patches will be moved to <tt>ftp://ftp.gimp.org/pub/gtk/patches</tt>
|
||||
Uploaded patches will be moved to <tt>ftp://ftp.gtk.org/pub/gtk/patches</tt>
|
||||
where one of the GTK+ development team will pick them up. If applied, they
|
||||
will be moved to <tt>/pub/gtk/patches/old</tt>.
|
||||
|
||||
@@ -374,13 +434,11 @@ gladly be included.
|
||||
Yes. There is
|
||||
<itemize>
|
||||
<item>a C++ wrapper for GTK+ called gtk--. You can find the home page at:
|
||||
<verb>
|
||||
http://www.cs.tut.fi/~p150650/gtk/gtk--.html
|
||||
</verb>
|
||||
The FTP site is:
|
||||
<verb>
|
||||
ftp://ftp.gimp.org/pub/gtk/gtk--/
|
||||
</verb>
|
||||
<htmlurl url="http://www.cs.tut.fi/~p150650/gtk/gtk--.html"
|
||||
name="http://www.cs.tut.fi/~p150650/gtk/gtk--.html">.
|
||||
The FTP site is
|
||||
<htmlurl url="ftp://ftp.gtk.org/pub/gtk/gtk--"
|
||||
name="ftp://ftp.gtk.org/pub/gtk/gtk--">.
|
||||
<p>
|
||||
|
||||
<item>There are two Objective-c bindings currently in development:
|
||||
@@ -395,7 +453,7 @@ ftp://ftp.gimp.org/pub/gtk/gtk--/
|
||||
<item>If you are more inclined towards the
|
||||
<htmlurl url="http://www.gnustep.org/" name="GNUstep project">,
|
||||
you may want to check out GTKKit by
|
||||
<htmlurl url="mailto:helge@mdlink.de" name="Helge Heszlig">.
|
||||
<htmlurl url="mailto:helge@mdlink.de" name="Helge Heß">.
|
||||
The intention is to setup a GTK+ binding using the FoundationKit.
|
||||
GTKKit includes nicities like writing a XML-type template file to
|
||||
construct a GTK+ interface.
|
||||
@@ -403,14 +461,12 @@ ftp://ftp.gimp.org/pub/gtk/gtk--/
|
||||
</itemize>
|
||||
<p>
|
||||
<item>Perl bindings
|
||||
<verb>
|
||||
ftp://ftp.gimp.org/pub/gtk/perl
|
||||
</verb>
|
||||
|
||||
<item>Guile bindings. The home page is at:
|
||||
<verb>
|
||||
http://www.ping.de/sites/zagadka/guile-gtk/
|
||||
</verb>
|
||||
<htmlurl url="ftp://ftp.gtk.org/pub/gtk/perl"
|
||||
name="ftp://ftp.gtk.org/pub/gtk/perl">
|
||||
<P>
|
||||
<item>Guile bindings. The home page is at
|
||||
<htmlurl url="http://www.ping.de/sites/zagadka/guile-gtk"
|
||||
name="http://www.ping.de/sites/zagadka/guile-gtk">.
|
||||
By the way, Guile is the GNU Project's implemention of R4RS Scheme (the
|
||||
standard). If you like Scheme, you may want to take a look at this.
|
||||
<p>
|
||||
@@ -420,24 +476,28 @@ standard). If you like Scheme, you may want to take a look at this.
|
||||
The basics of the system, including callbacks, work fine.
|
||||
|
||||
The current development is in
|
||||
http://www.ens-lyon.fr/~dmonniau/arcs/
|
||||
<htmlurl url="http://www.ens-lyon.fr/~dmonniau/arcs"
|
||||
name="http://www.ens-lyon.fr/~dmonniau/arcs">
|
||||
</quote>
|
||||
|
||||
<item>
|
||||
Several python-gtk interfaces have been done. python-gtk is at:
|
||||
<verb>
|
||||
http://www.acs.ucalgary.cs/~nashceme/python-gtk/
|
||||
</verb>
|
||||
If you try python-gtk and don't like it, there's also pygtk located at:
|
||||
<verb>
|
||||
ftp://ftp.gimp.org/pub/gtk/python/
|
||||
</verb>
|
||||
|
||||
Several python bindings have been done:
|
||||
<p>
|
||||
<itemize>
|
||||
<item>pygtk is at
|
||||
<htmlurl url="http://www.daa.com.au/~james/pygtk"
|
||||
name="http://www.daa.com.au/~james/pygtk"> and
|
||||
<htmlurl url="ftp://ftp.gtk.org/pub/gtk/python"
|
||||
name="ftp://ftp.gtk.org/pub/gtk/python">
|
||||
<item>python-gtk is at
|
||||
<htmlurl url="http://www.ucalgary.ca/~nascheme/python-gtk"
|
||||
name="http://www.ucalgary.ca/~nascheme/python-gtk">
|
||||
</itemize>
|
||||
<p>
|
||||
<item>
|
||||
There's a OpenGL/Mesa widget available for GTK+. Grab it at:
|
||||
<verb>
|
||||
http://www.sakuranet.or.jp/~aozasa/shige/doc/comp/gtk/gtkGL/files-en.html
|
||||
</verb>
|
||||
There's a OpenGL/Mesa widget available for GTK+. Grab it at
|
||||
<htmlurl url="http://www.sakuranet.or.jp/~aozasa/shige/doc/comp/gtk/gtkGL/files-en.html"
|
||||
name="http://www.sakuranet.or.jp/~aozasa/shige/doc/comp/gtk/gtkGL/files-en.html">
|
||||
|
||||
</itemize>
|
||||
|
||||
@@ -449,9 +509,9 @@ http://www.sakuranet.or.jp/~aozasa/shige/doc/comp/gtk/gtkGL/files-en.html
|
||||
<p>
|
||||
So, after you have installed GTK+ there are a couple of things that can
|
||||
ease you into developing applications with it. There is the
|
||||
GTK+ Tutorial <htmlurl url="http://www.levien.com/~slow/gtk/tutorial"
|
||||
name="<http://www.levien.com/~slow/gtk/tutorial>">, which is undergoing development. This will introduce you
|
||||
to writing applications using C.
|
||||
GTK+ Tutorial <htmlurl url="http://www.gtk.org/tutorial/"
|
||||
name="<http://www.gtk.org/tutorial/>">, which is undergoing
|
||||
development. This will introduce you to writing applications using C.
|
||||
|
||||
The Tutorial doesn't (yet) contain information on all of the widgets
|
||||
that are in GTK+. For example code on how to use the basics of all the
|
||||
@@ -503,6 +563,7 @@ The GTK+ Tutorial lists the following widgets:
|
||||
| | `GtkCheckButton
|
||||
| | `GtkRadioButton
|
||||
| +GtkCList
|
||||
| `GtkCTree
|
||||
| +GtkFixed
|
||||
| +GtkList
|
||||
| +GtkMenuShell
|
||||
@@ -545,6 +606,58 @@ The GTK+ Tutorial lists the following widgets:
|
||||
`GtkVSeparator
|
||||
</verb>
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>Is GTK+ thread safe? How do I write multi-threaded GTK+ applications?
|
||||
<p>
|
||||
Although GTK+, like many X toolkits, isn't thread safe, this does
|
||||
not prohibit the development of multi-threaded applications with
|
||||
GTK+.
|
||||
|
||||
Rob Browning (rlb@cs.utexas.edu) describes threading techniques for
|
||||
use with GTK+ (slightly edited):
|
||||
|
||||
There are basically two main approaches, the first is simple, and the
|
||||
second complicated. In the first, you just make sure that all GTK+ (or
|
||||
X) interactions are handled by one, and
|
||||
only one, thread. Any other thread that wants to draw something has
|
||||
to somehow notify the "GTK+" thread, and let it handle the
|
||||
actual work.
|
||||
|
||||
The second approach allows you to call GTK+ (or X) functions from any
|
||||
thread, but it requires some careful synchronization. The
|
||||
basic idea is that you create an X protection mutex, and no one may
|
||||
make any X calls without first acquiring this mutex.
|
||||
|
||||
Note that this is a little effort, but it allows you to be
|
||||
potentially more efficient than a completely thread safe GTK+. You
|
||||
get to decide the granularity of the thread locking. You also have to
|
||||
make sure that the thread that calls gtk_main is holding the lock when
|
||||
it calls gtk_main.
|
||||
|
||||
The next thing to worry about is that since you were holding the
|
||||
global mutex when you entered gtk_main, all callbacks will also be
|
||||
holding it. This means that the callback must release it if it's
|
||||
going to call any other code that might reacquire it. Otherwise
|
||||
you'll get deadlock. Also, you must be holding the mutex when you
|
||||
finally return from the callback.
|
||||
|
||||
In order to allow threads other than the one calling gtk_main to
|
||||
get access to the mutex, we also need to register a work function
|
||||
with GTK that allows us to release the mutex periodically.
|
||||
|
||||
Why can't GTK+ be thread safe by default?
|
||||
|
||||
Complexity, overhead, and manpower. The proportion of threaded
|
||||
programs is still reasonably small, and getting thread safety right is
|
||||
both quite difficult and takes valuable time away from the main work
|
||||
of getting a good graphics library finished. It would be nice to have
|
||||
GTK+ thread safe "out of the box", but that's not practical right now,
|
||||
and it also might make GTK+ substantially less efficient if not handled
|
||||
carefully.
|
||||
|
||||
Regardless, it's especially not a priority since relatively good
|
||||
workarounds exist.
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>How can I prevent redrawing and resizing while I change multiple widgets?
|
||||
<p>
|
||||
@@ -553,7 +666,7 @@ code where you are changing a lot of stuff. This will result in much faster
|
||||
speed since it will prevent resizing of the entire widget hierarchy.
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>How do I catch a double click event in a list widget?
|
||||
<sect1>How do I catch a double click event (in a list widget, for example)?
|
||||
<p>
|
||||
Tim Janik wrote to gtk-list (slightly modified):
|
||||
|
||||
@@ -596,7 +709,15 @@ And connect the handler to your object:
|
||||
/* something else */
|
||||
}
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
and, Owen Taylor wrote:
|
||||
|
||||
Note that a single button press will be received beforehand, and
|
||||
if you are doing this for a button, you will therefore also get a
|
||||
"clicked" signal for the button. (This is going to be true for
|
||||
any toolkit, since computers aren't good at reading one's
|
||||
mind.)
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>How do I find out about the selection of a GtkList?
|
||||
<p>
|
||||
@@ -752,7 +873,7 @@ determined it didn't look good and removed it.
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>How can I define a separation line in a menu?
|
||||
<p>
|
||||
See the <htmlurl url="http://www.levien.com/~slow/gtk/"
|
||||
See the <htmlurl url="http://www.gtk.org/tutorial/"
|
||||
name="Tutorial"> for information on how to create menus.
|
||||
However, to create a separation line in a menu, just insert an
|
||||
empty menu item:
|
||||
@@ -772,6 +893,31 @@ Use something like the following:
|
||||
menu_path = gtk_menu_factory_find (factory, "<MyApp>/Help");
|
||||
gtk_menu_item_right_justify(menu_path->widget);
|
||||
</verb></tscreen>
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>How do I make my window modal? / How do I make a single window active?
|
||||
<p>
|
||||
After you create your window, do gtk_grab_add(my_window). And after
|
||||
closing the window do gtk_grab_remove(my_window).
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>Why doesn't my widget (e.g. progressbar) update?
|
||||
<p>
|
||||
|
||||
You are probably doing all the changes within a function
|
||||
without returning control to gtk_main. Most drawing updates are only
|
||||
placed on a queue, which is processed within gtk_main. You can
|
||||
force the drawing queue to be processed using something like:
|
||||
|
||||
<tscreen><verb>
|
||||
while (gtk_events_pending())
|
||||
gtk_main_iteration();
|
||||
</verb></tscreen>
|
||||
|
||||
inside you're function that changes the widget.
|
||||
|
||||
What the above snippet does is run all pending events and high priority
|
||||
idle functions, then return immediately (the drawing is done in a
|
||||
high priority idle function).
|
||||
|
||||
<!-- ***************************************************************** -->
|
||||
<sect>About gdk
|
||||
|
||||
49
docs/gtk-config.1
Normal file
49
docs/gtk-config.1
Normal file
@@ -0,0 +1,49 @@
|
||||
.TH GTK+ 1 "11 May 1998" Version 1.0.2
|
||||
.SH NAME
|
||||
gtk-config - script to get information about the installed version of GTK+
|
||||
.SH SYNOPSIS
|
||||
.B gtk-config
|
||||
[\-\-prefix\fI[=DIR]\fP] [\-\-exec\-prefix\fI[=DIR]\fP] [\-\-version] [\-\-libs] [\-\-cflags]
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\fIgtk-config\fP is a tool that is used to configure to determine
|
||||
the compiler and linker flags that should be used to compile
|
||||
and link programs that use \fIGTK+\fP. It is also used internally
|
||||
to the .m4 macros for GNU autoconf that are included with \fIGTK+\fP.
|
||||
.
|
||||
.SH OPTIONS
|
||||
.l
|
||||
\fIgtk-config\fP accepts the following options:
|
||||
.TP 8
|
||||
.B \-\-version
|
||||
Print the currently installed version of \fIGTK+\fP on the standard output.
|
||||
.TP 8
|
||||
.B \-\-libs
|
||||
Print the linker flags that are necessary to link a \fIGTK+\fP program.
|
||||
.TP 8
|
||||
.B \-\-cflags
|
||||
Print the compiler flags that are necessary to compile a \fIGTK+\fP program.
|
||||
.TP 8
|
||||
.B \-\-prefix=PREFIX
|
||||
If specified, use PREFIX instead of the installation prefix that \fIGTK+\fP
|
||||
was built with when computing the output for the \-\-cflags and
|
||||
\-\-libs options. This option is also used for the exec prefix
|
||||
if \-\-exec\-prefix was not specified. This option must be specified
|
||||
before any \-\-libs or \-\-cflags options.
|
||||
.TP 8
|
||||
.B \-\-exec\-prefix=PREFIX
|
||||
If specified, use PREFIX instead of the installation exec prefix that
|
||||
\fIGTK+\fP was built with when computing the output for the \-\-cflags
|
||||
and \-\-libs options. This option must be specified before any
|
||||
\-\-libs or \-\-cflags options.
|
||||
.SH SEE ALSO
|
||||
.BR gimp (1),
|
||||
.BR gimptool (1)
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 1995 Spencer Kimball and Peter Mattis
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation.
|
||||
228
docs/gtk-config.txt
Normal file
228
docs/gtk-config.txt
Normal file
@@ -0,0 +1,228 @@
|
||||
CONFIGURING PACKAGES TO WORK WITH GTK
|
||||
-------------------------------------
|
||||
|
||||
Compiling a program succesfully against the GTK, GDK, and GLIB
|
||||
libraries can require a large number of command line options
|
||||
to your compiler and linker that are hard to guess correctly.
|
||||
The additional libraries required may, for example, depend on the
|
||||
manner which GTK was configured
|
||||
|
||||
Several tools are included in this package to make process
|
||||
easier.
|
||||
|
||||
First, there is the shell script 'gtk-config' (installed in
|
||||
$exec_prefix/bin):
|
||||
|
||||
Invoking gtk-config
|
||||
-------------------
|
||||
|
||||
gtk-config takes the following flags:
|
||||
|
||||
--version
|
||||
Prints out the version of GTK installed
|
||||
|
||||
--cflags
|
||||
Prints '-I' flags pointing to the installed header files.
|
||||
|
||||
--libs
|
||||
Prints out the linker flags necessary to link a program against GTK
|
||||
|
||||
--prefix[=PREFIX]
|
||||
If PREFIX is specified, overrides the configured value of $prefix.
|
||||
(And of exec-prefix, unless --exec-prefix is also specified)
|
||||
Otherwise, prints out the configured value of $prefix
|
||||
|
||||
--exec-prefix[=PREFIX]
|
||||
If PREFIX is specified, overrides the configured value of $exec_prefix.
|
||||
Otherwise, prints out the configured value of $exec_prefix
|
||||
|
||||
|
||||
|
||||
Example of using gtk-config
|
||||
---------------------------
|
||||
|
||||
Typically, gtk-config will be used within a configure script,
|
||||
as described below. It, however, can also be used directly
|
||||
from the command line to compile a simple program. For example:
|
||||
|
||||
cc -o simple `gtk-config --cflags` simple.c `gtk-config --libs`
|
||||
|
||||
This command line might expand to (for example):
|
||||
|
||||
cc -o simple -I/usr/local/lib/glib/include -I/usr/local/include \
|
||||
-I/usr/X11R6/include simple.c -L/usr/local/lib -L/usr/X11R6/lib \
|
||||
-lgtk -lgdk -lglib -lXi -lXext -lX11 -lm
|
||||
|
||||
Not only is the form using gtk-config easier to type, it will
|
||||
work on any system, no matter how GTK was configured.
|
||||
|
||||
|
||||
AM_PATH_GTK
|
||||
-----------
|
||||
|
||||
For packages configured using GNU automake, GTK also provides
|
||||
a macro to automate the process of running GTK.
|
||||
|
||||
AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
|
||||
This macro:
|
||||
|
||||
* Determines the location of GTK using gtk-config, which is either
|
||||
found in the user's path, or from the environment variable
|
||||
GTK_CONFIG
|
||||
|
||||
* Tests the installed libraries to make sure that there version
|
||||
is later than MINIMUM-VERSION. (A default version will be used
|
||||
if not specified)
|
||||
|
||||
* If the required version was found, sets the GTK_CFLAGS variable to
|
||||
the output of `gtk-config --cflags` and the GTK_LIBS variable to
|
||||
the output of `gtk-config --libs`, and calls AC_SUBST() for these
|
||||
variables so they can be used in generated makefiles, and then
|
||||
executes ACTION-IF-FOUND.
|
||||
|
||||
* If the required version was not found, sets GTK_CFLAGS and GTK_LIBS
|
||||
to empty strings, and executes ACTION-IF-NOT-FOUND.
|
||||
|
||||
This macro is in file 'gtk.m4' which is installed in $datadir/aclocal.
|
||||
Note that if automake was installed with a different --prefix than
|
||||
GTK, you will either have to manually move gtk.m4 to automake's
|
||||
$datadir/aclocal, or give aclocal the -I option when running it.
|
||||
|
||||
|
||||
Configuring a package that uses AM_PATH_GTK
|
||||
-------------------------------------------
|
||||
|
||||
Simply make sure that gtk-config is in your path, and run
|
||||
the configure script.
|
||||
|
||||
Notes:
|
||||
|
||||
* The directory where the GTK libraries are installed needs
|
||||
to be found by your system's dynamic linker.
|
||||
|
||||
This is generally done by
|
||||
|
||||
editing /etc/ld.so.conf and running ldconfig
|
||||
|
||||
Or by:
|
||||
|
||||
setting the environment variable LD_LIBRARY_PATH,
|
||||
|
||||
or, as a last resort,
|
||||
|
||||
Giving a -R or -rpath flag (depending on your linker) when
|
||||
running configure, for instance:
|
||||
|
||||
LDFLAGS=-R/usr/home/owen/lib ./configure
|
||||
|
||||
* You can also specify a gtk-config not in your path by
|
||||
setting the GTK_CONFIG environment variable to the
|
||||
name of the executable
|
||||
|
||||
* If you move the GTK package from its installed location,
|
||||
you will need either need to modify gtk-config script
|
||||
manually to point to the new location or rebuild GTK.
|
||||
|
||||
Advanced note:
|
||||
|
||||
* configure flags
|
||||
|
||||
--with-gtk-prefix=PREFIX
|
||||
--with-gtk-exec-prefix=PREFIX
|
||||
|
||||
are provided to override the prefix and exec-prefix that were stored
|
||||
in the gtk-config shell script by GTK's configure. You are generally
|
||||
better off configuring GTK with the right path to begin with.
|
||||
|
||||
Example of a package using AM_PATH_GTK
|
||||
--------------------------------------
|
||||
|
||||
The following shows how to build a simple package using automake
|
||||
and the AM_PATH_GTK macro. The program used here is the testinput.c
|
||||
|
||||
You should first read the introductory portions of the automake
|
||||
Manual, if you are not already familiar with it.
|
||||
|
||||
Two files are needed, 'configure.in', which is used to build the
|
||||
configure script:
|
||||
|
||||
==configure.in===
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(testinput.c)
|
||||
|
||||
AM_INIT_AUTOMAKE(testinput.c, 1.0.0)
|
||||
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_STDC
|
||||
AC_PROG_INSTALL
|
||||
|
||||
AM_PATH_GTK(0.99.5,
|
||||
[LIBS="$LIBS $GTK_LIBS"
|
||||
CFLAGS="$CFLAGS $GTK_CFLAGS"],
|
||||
AC_MSG_ERROR(Cannot find GTK: Is gtk-config in path?))
|
||||
|
||||
AC_OUTPUT(Makefile)
|
||||
=================
|
||||
|
||||
The only command in this which is not standard for automake
|
||||
is the AM_PATH_GTK() macro.
|
||||
|
||||
That command does the following:
|
||||
|
||||
If a GTK version greater than 0.99.5 is found, adds $GTK_LIBS to
|
||||
$LIBS and $GTK_CFLAGS to $CFLAGS. Otherwise, dies with the error
|
||||
message "Cannot find GTK: Is gtk-config in path?"
|
||||
|
||||
And the 'Makefile.am', which will be used to build the Makefile.
|
||||
|
||||
== Makefile.am ==
|
||||
bin_PROGRAMS = testinput
|
||||
testinput_SOURCES = testinput.c
|
||||
=================
|
||||
|
||||
This Makefile.am, says that we are building a single executable,
|
||||
from a single sourcefile 'testinput.c'. Since every program
|
||||
we are building uses GTK we simply added the GTK options
|
||||
to $LIBS and $CFLAGS, but in other circumstances, we might
|
||||
want to specify them on a per-program basis: for instance by
|
||||
adding the lines:
|
||||
|
||||
testinput_LDADD = $(GTK_LIBS)
|
||||
INCLUDES = $(GTK_CFLAGS)
|
||||
|
||||
to the Makefile.am.
|
||||
|
||||
To try this example out, create a new directory, add the two
|
||||
files above two it, and copy the testinput.c file from
|
||||
the gtk/ subdirectory to the new directory. Edit the line:
|
||||
|
||||
#include "gtk.h"
|
||||
|
||||
in testgtk.c, to read:
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
Now execute the following commands:
|
||||
|
||||
automake --add-missing
|
||||
aclocal
|
||||
autoconf
|
||||
|
||||
You now have a package that can be built in the normal fashion
|
||||
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
|
||||
Notes:
|
||||
|
||||
* If you are converting a package that used a pre-1.0 version of
|
||||
GTK, you should remove the autoconf tests for X. The results
|
||||
of these tests are included in gtk-config and will be added
|
||||
to GTK_LIBS and GTK_CFLAGS by the AM_PATH_GTK macro.
|
||||
|
||||
Owen Taylor
|
||||
14 Mar 1997
|
||||
@@ -13,7 +13,7 @@
|
||||
@set update-month January 1998
|
||||
|
||||
@ifinfo
|
||||
This file documents GTK, the General Toolkit
|
||||
This file documents GTK, the GIMP Toolkit
|
||||
|
||||
Copyright (C) 1996 Peter Mattis
|
||||
Copyright (C) 1997 Peter Mattis
|
||||
@@ -41,7 +41,7 @@ approved by Peter Mattis.
|
||||
@end ifinfo
|
||||
|
||||
@titlepage
|
||||
@title The General Toolkit
|
||||
@title The GIMP Toolkit
|
||||
@subtitle Version @value{edition}
|
||||
@subtitle @value{update-month}
|
||||
@author by Peter Mattis
|
||||
@@ -69,11 +69,11 @@ approved by Peter Mattis.
|
||||
|
||||
@dircategory User Interface Toolkit
|
||||
@direntry
|
||||
* GTK: (gtk). The General Toolkit
|
||||
* GTK: (gtk). The GIMP Toolkit
|
||||
@end direntry
|
||||
|
||||
@node Top, Copying, (dir), (dir)
|
||||
@top The General Toolkit
|
||||
@top The GIMP Toolkit
|
||||
@ifinfo
|
||||
This is edition @value{edition} of the GTK documentation,
|
||||
@w{@value{update-date}}.
|
||||
@@ -763,6 +763,7 @@ The available widgets (in alphabetical order):
|
||||
* GtkCombo:: The combo box widget.
|
||||
* GtkContainer:: The container widget.
|
||||
* GtkCurve:: The curve widget.
|
||||
* GtkGammaCurve:: The gamma curve widget.
|
||||
* GtkDialog:: The dialog widget.
|
||||
* GtkDrawingArea:: The drawing area widget.
|
||||
* GtkEntry:: The entry widget.
|
||||
@@ -953,6 +954,10 @@ structure directly (or, for that matter, any type derived from
|
||||
|
||||
@subsection Description
|
||||
|
||||
Ensure that the child window has a specified aspect ratio or, if
|
||||
obey_child, has the same aspect ratio as its requested size. Derived
|
||||
from @pxref{GtkFrame}).
|
||||
|
||||
@subsection Options
|
||||
|
||||
@defopt label
|
||||
@@ -1326,6 +1331,10 @@ function in the @var{widget} variable.
|
||||
|
||||
@subsection Description
|
||||
|
||||
A pressable button. Contains a widget. Changes its appearance
|
||||
(hilites) when it gets the focus. Changes its appearance (pressed) when
|
||||
activated. Derived from @pxref{GtkContainer}.
|
||||
|
||||
@subsection Signals
|
||||
|
||||
@deftypefn Signal void GtkButton::pressed (GtkButton *@var{button})
|
||||
@@ -1386,6 +1395,10 @@ pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
|
||||
|
||||
@subsection Description
|
||||
|
||||
Another form of toggle button (@pxref{GtkToggleButton}) with an
|
||||
indicator. Contains a widget to the right of the indicator. Changes
|
||||
its appearance (hilites) when it gets the focus.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@subsection Signals
|
||||
@@ -1426,6 +1439,11 @@ values @var{label}. The new widget is returned as a pointer to a
|
||||
|
||||
@subsection Description
|
||||
|
||||
Derived from @pxref{GtkMenuItem}. Very similar to a checkbutton
|
||||
(@pxref{GtkCheckButton}), except that it's a menu item. Has a toggled
|
||||
state which is displayed in a small rectangle to the left of the
|
||||
contained widget.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@defopt label
|
||||
@@ -1471,6 +1489,11 @@ object. @code{NULL} is returned on failure.
|
||||
|
||||
@subsection Description
|
||||
|
||||
A list of rows of columns, with a title row. You can insert rows, and
|
||||
delete rows. The user can scroll around and select a row. Derived from
|
||||
@pxref{GtkContainer}. Cells can be empty, have a text and/or pixmap, or
|
||||
be a widget.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@subsection Signals
|
||||
@@ -1641,6 +1664,12 @@ This is much faster then removing each item separately with
|
||||
|
||||
@subsection Description
|
||||
|
||||
A widget that allows a user to pick a color in one of many ways. They
|
||||
can click on a color wheel or saturation bar. They can change hue,
|
||||
saturation, value, red, green, or blue with a slider, or by entering
|
||||
values. Also allows the user to set an alpha (opacity) value. Derived
|
||||
from @pxref{GtkVBox}.
|
||||
|
||||
@subsection Options
|
||||
@defopt policy
|
||||
@itemize @bullet
|
||||
@@ -1706,6 +1735,9 @@ to a @code{GtkWidget} object. @code{NULL} is returned on failure.
|
||||
|
||||
@subsection Description
|
||||
|
||||
Text input box which also lets you choose from pre-defined values from a
|
||||
drop-down menu. Derived from @pxref{GtkHBox}.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@subsection Signals
|
||||
@@ -1748,6 +1780,11 @@ a @code{GtkWidget} object. @code{NULL} is returned on failure.
|
||||
|
||||
@subsection Description
|
||||
|
||||
A base class for objects that are built out of other widgets. Many
|
||||
widgets are containers. For example, a button contains a widget. That
|
||||
widget might be a text label (usually is), or a pixmap, or even an hbox
|
||||
which has a label and a pixmap.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@defopt border_width
|
||||
@@ -1817,12 +1854,14 @@ Remove @var{widget} from @var{container}.
|
||||
@gtkstdmacros{Container, CONTAINER}
|
||||
|
||||
@page
|
||||
@node GtkCurve, GtkDialog, GtkContainer, Widgets
|
||||
@node GtkCurve, GtkGammaCurve, GtkContainer, Widgets
|
||||
@comment node-name, next, previous, up
|
||||
@section The curve widget
|
||||
|
||||
@subsection Description
|
||||
|
||||
Derived from @pxref{GtkDrawingArea}.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@defopt type
|
||||
@@ -1867,7 +1906,39 @@ Create a new @code{GtkCurve} returning the new widget as a pointer to a
|
||||
@gtkstdmacros{Curve, CURVE}
|
||||
|
||||
@page
|
||||
@node GtkDialog, GtkDrawingArea, GtkCurve, Widgets
|
||||
@node GtkGammaCurve, GtkDialog, GtkCurve, Widgets
|
||||
@comment node-name, next, previous, up
|
||||
@section The gamma curve widget
|
||||
|
||||
@subsection Description
|
||||
|
||||
Lets the user edit a gamma curve (a one-to-one mapping usually used to
|
||||
adjust the intensity of an image to the physical characteristics of the
|
||||
output device). You can set the minimum and maximum values for input
|
||||
and output. You can set the initial vector as well. You are guaranteed
|
||||
that every input value will have a (not necessarily unique) output value
|
||||
specified. Derived from @pxref{GtkVBox}. Makes use of @pxref{GtkCurve} to
|
||||
draw the curve.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@subsection Signals
|
||||
|
||||
@subsection Functions
|
||||
|
||||
@deftypefun guint gtk_gamma_curve_get_type (void)
|
||||
Returns the @code{GtkGamma} type identifier.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GtkWidget* gtk_gamma_curve_new (void)
|
||||
Create a new @code{GtkGamma} returning the new widget as a pointer to a
|
||||
@code{GtkWidget} object.
|
||||
@end deftypefun
|
||||
|
||||
@gtkstdmacros{GammaCurve, GAMMACURVE}
|
||||
|
||||
@page
|
||||
@node GtkDialog, GtkDrawingArea, GtkGammaCurve, Widgets
|
||||
@comment node-name, next, previous, up
|
||||
@section The dialog widget
|
||||
|
||||
@@ -1902,6 +1973,9 @@ to a @code{GtkWidget} object. @code{NULL} is returned on failure.
|
||||
|
||||
@subsection Description
|
||||
|
||||
A base class for widgets that need a box to draw into. So far, only
|
||||
used by GtkCurve.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@defopt width
|
||||
@@ -1938,6 +2012,12 @@ Set the size of the @var{darea} widget, created previously, to @var{width} and @
|
||||
|
||||
@subsection Description
|
||||
|
||||
@comment Enter text into this widget. Derived from @pxref{GtkEditable}. Can be
|
||||
@comment set so it isn't editable.
|
||||
|
||||
Enter text into this widget. Derived from GtkEditable. Can be
|
||||
set so it isn't editable.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@defopt max
|
||||
@@ -2025,6 +2105,8 @@ Returns the text that is contained in the @code{GtkEntry} as a pointer to a
|
||||
|
||||
@subsection Description
|
||||
|
||||
Derived from @pxref{GtkBin}. Used by @pxref{GtkTreeItem}.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@subsection Signals
|
||||
@@ -3582,6 +3664,10 @@ Create a new @code{GtkText} object initializing it with the values in
|
||||
|
||||
@subsection Description
|
||||
|
||||
Another form of button (@pxref{GtkButton}) with two states: on and off.
|
||||
The appearance is that of a button which stays pressed on the first
|
||||
click, and is released on the second click.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@defopt state
|
||||
|
||||
9969
docs/gtk_tut.sgml
Normal file
9969
docs/gtk_tut.sgml
Normal file
File diff suppressed because it is too large
Load Diff
10090
docs/gtk_tut_it.sgml
Normal file
10090
docs/gtk_tut_it.sgml
Normal file
File diff suppressed because it is too large
Load Diff
BIN
docs/gtk_tut_packbox1.gif
Normal file
BIN
docs/gtk_tut_packbox1.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
BIN
docs/gtk_tut_packbox2.gif
Normal file
BIN
docs/gtk_tut_packbox2.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
BIN
docs/gtk_tut_table.gif
Normal file
BIN
docs/gtk_tut_table.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/perl -w
|
||||
#!/usr/bin/perl
|
||||
|
||||
# Stupid script to fix look of html files created with sgml2html...
|
||||
|
||||
@@ -8,3 +8,4 @@ foreach (@ARGV) {
|
||||
system("sed -e 's/<BODY>/<BODY BGCOLOR=\"#FFFFFF\">/g' -e 's/<HR>/<HR NOSHADE>/g' $_.orig > $_");
|
||||
unlink("$_.orig");
|
||||
}
|
||||
|
||||
338
docs/gtkfaq.sgml
338
docs/gtkfaq.sgml
@@ -8,7 +8,7 @@
|
||||
|
||||
<!-- NOTE: Use only one author tag, otherwise sgml2txt barfs - TRG -->
|
||||
<author>Nathan Froyd, Tony Gale, Shawn T. Amundson.
|
||||
<date>March 9th 1998
|
||||
<date>May 11th 1998
|
||||
<abstract>
|
||||
This document is intended to answer questions that are likely to be
|
||||
frequently asked by programmers using GTK+ or people who are just
|
||||
@@ -79,19 +79,17 @@ GNU, though."
|
||||
<sect1>Where is the documentation for GTK+?
|
||||
<p>
|
||||
In the GTK+ distribution's doc/ directory you will find the
|
||||
reference material for both GTK and GDK, and this FAQ.
|
||||
reference material for both GTK and GDK, this FAQ and the
|
||||
GTK Tutorial.
|
||||
|
||||
There is also a GTK+ Tutorial which can be found at
|
||||
<htmlurl url="http://www.levien.com/~slow/gtk/"
|
||||
name="http://www.levien.com/~slow/gtk/">.
|
||||
In addition, you can find links to HTML versions of these documents
|
||||
by going to
|
||||
<htmlurl url="http://www.gtk.org/"
|
||||
name="http://www.gtk.org/">.
|
||||
|
||||
The Tutorial and FAQ can also be found at
|
||||
<htmlurl url="http://www.geocities.com/ResearchTriangle/Lab/4299/"
|
||||
name="http://www.geocities.com/ResearchTriangle/Lab/4299/">.
|
||||
|
||||
In addition, you can find links to all of these documents by going to
|
||||
<htmlurl url="http://www.gimp.org/gtk/docs"
|
||||
name="http://www.gimp.org/gtk/docs">.
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>Is there a mailing list (or mailing list archive) for GTK+?
|
||||
@@ -110,7 +108,7 @@ email message to <htmlurl url="mailto:gtk-list-request@redhat.com"
|
||||
name="gtk-list-request@redhat.com">
|
||||
with <em>subscribe</em> in the <bf>subject</bf>.
|
||||
<p>
|
||||
A searchable archive of the mailing list can be found at <htmlurl url="http://www.redhat.com/linux-info/gtk/gtk-list/index.html" name="http://www.redhat.com/linux-info/gtk/gtk-list/index.html">
|
||||
A searchable archive of the mailing list can be found at <htmlurl url="http://archive.redhat.com/gtk-list" name="http://archive.redhat.com/gtk-list">
|
||||
</itemize>
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>The gtk-list hasn't had any traffic for days, is it dead?
|
||||
@@ -165,6 +163,23 @@ name="http://www.gnome.org">)
|
||||
is using GTK+ to build a free desktop for Linux. Many more programs can be found
|
||||
there.
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>I'm looking for an application to write in GTK+. How about an IRC client?
|
||||
<p>
|
||||
|
||||
Ask on gtk-list for suggestions. There are at least four IRC
|
||||
clients already under development.
|
||||
|
||||
<itemize>
|
||||
<item>girc. (Included with GNOME)
|
||||
<item>Bezerk (<htmlurl url="http://www.gtk.org/~trog/"
|
||||
name="http://www.gtk.org/~trog/">)
|
||||
<item>gsirc. (Location?)
|
||||
<item>Gnirc. (<htmlurl url="http://www.imaginet.fr/~dramboz/gnirc"
|
||||
name="http://www.imaginet.fr/~dramboz/gnirc">)
|
||||
</itemize>
|
||||
|
||||
|
||||
<!-- ***************************************************************** -->
|
||||
<sect>How to find, configure, install, and troubleshoot GTK+
|
||||
|
||||
@@ -181,9 +196,9 @@ and associated libraries on your system.
|
||||
<p>
|
||||
The canonical site is:
|
||||
<verb>
|
||||
ftp://ftp.gimp.org/pub/gtk
|
||||
ftp://ftp.gtk.org/pub/gtk
|
||||
</verb>
|
||||
Of course, any mirrors of ftp.gimp.org should have the latest version, too.
|
||||
Of course, any mirrors of ftp.gtk.org should have the latest version, too.
|
||||
|
||||
<sect1>How do I configure/compile GTK+?
|
||||
<p>
|
||||
@@ -204,22 +219,37 @@ handle the automatically generated Makefiles.
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
|
||||
<sect1>I've compiled and installed GTK+, but I can't get any programs to link
|
||||
with it!
|
||||
<sect1>I've compiled and installed GTK+, but I can't get any programs to link with it!
|
||||
<p>
|
||||
This problem is most often encountered when the GTK+ libraries can't be
|
||||
found or are the wrong version. Generally, the compiler will complain about an
|
||||
'unresolved symbol'. There are two things you need to check:
|
||||
<itemize>
|
||||
<item>Make sure that the libraries can be found. You want to edit
|
||||
/etc/ld.so.conf to include /usr/local/lib (or whereever you installed GTK+),
|
||||
/etc/ld.so.conf to include the directories which contain the GTK libraries,
|
||||
so it looks something like:
|
||||
<verb>
|
||||
/usr/X11R6/lib
|
||||
/usr/local/lib
|
||||
</verb>
|
||||
Then you need to run /sbin/ldconfig as root.
|
||||
<p>
|
||||
Then you need to run /sbin/ldconfig as root. You can find what directory
|
||||
GTK is in using
|
||||
<verb>
|
||||
gtk-config --libs
|
||||
</verb>
|
||||
|
||||
If your system doesn't use ld.so to find libraries (such as Solaris), then
|
||||
you will have to use the LD_LIBRARY_PATH environment variable (or compile
|
||||
the path into your program, which I'm not going to cover here). So, with a
|
||||
Bourne type shell you can do (if your GTK libraries are in /usr/local/lib):
|
||||
<verb>
|
||||
export LD_LIBRARY_PATH=/usr/local/lib
|
||||
</verb>
|
||||
and in a csh, you can do:
|
||||
<verb>
|
||||
setenv LD_LIBRARY_PATH /usr/local/lib
|
||||
</verb>
|
||||
|
||||
<item>Make sure the linker is finding the correct set of libraries. If you
|
||||
have a Linux distribution that installs GTK+ (e.g. RedHat 5.0) then this
|
||||
older version may be used. Now (assuming you have a RedHat
|
||||
@@ -235,50 +265,80 @@ the libraries libgtk, libgdk, libglib, or libgck. If they do exist, remove them
|
||||
and reinstall gtk+.
|
||||
</itemize>
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>When compiling programs with GTK+, I get compiler error messages about not being able to find <tt/"glibconfig.h"/.
|
||||
|
||||
<p> The header file "glibconfig.h" was moved to the directory
|
||||
$exec_prefix/lib/glib/include/. $exec_prefix is the
|
||||
directory that was specified by giving the --exec-prefix
|
||||
flags to ./configure when compiling GTK+. It defaults to
|
||||
$prefix, (specified with --prefix), which in turn defaults
|
||||
to /usr/local/.
|
||||
|
||||
This was done because "glibconfig.h" includes architecture
|
||||
dependent information, and the rest of the include files
|
||||
are put in $prefix/include, which can be shared between different
|
||||
architectures.
|
||||
|
||||
GTK+ includes a shell script, <tt/gtk-config/, that
|
||||
makes it easy to find out the correct include paths.
|
||||
The GTK+ tutorial includes an example of using <tt/gtk-config/
|
||||
for simple compilation from the command line. For information
|
||||
about more complicated configuration, see the file
|
||||
docs/gtk-config.txt in the GTK+ distribution.
|
||||
|
||||
If you are trying to compile an old program, you may
|
||||
be able to work around the problem by configuring it
|
||||
with a command line like:
|
||||
|
||||
<tscreen><verb>
|
||||
CPPFLAGS="-I/usr/local/include/glib/include" ./configure
|
||||
</verb></tscreen>
|
||||
|
||||
for Bourne-compatible shells like bash, or for csh variants:
|
||||
|
||||
<tscreen><verb>
|
||||
setenv CPPFLAGS "-I/usr/local/include/glib/include"
|
||||
./configure
|
||||
</verb></tscreen>
|
||||
|
||||
(Substitute the appropriate value of $exec_prefix for /usr/local.)
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>When installing The GIMP, configure reports that it can't find GTK.
|
||||
<p>
|
||||
There are several common reasons for this:
|
||||
<itemize>
|
||||
<item>You have an old version of GTK installed somewhere. RedHat 5.0, for
|
||||
example, installs an older copy of GTK that will not work with the latest
|
||||
versions of GIMP. You should remove this old copy, but note that in the case
|
||||
of RedHat 5.0 this will break the <tt/control-panel/ applications.
|
||||
<P>
|
||||
<item><tt/gtk-config/ (or another component of GTK) isn't in your path, or
|
||||
there is an old version on your system. Type:
|
||||
<verb>
|
||||
gtk-config --version
|
||||
</verb>
|
||||
to check for both of these. This should return a value of at least 0.99.8
|
||||
for things to work properly with GIMP 0.99.23. If it returns a value
|
||||
different from what you expect, then you have an old version of GTK on
|
||||
your system.
|
||||
<P>
|
||||
<item>The ./configure script can't find the GTK libraries. As ./configure
|
||||
compiles various test programs, it needs to be able to find the GTK
|
||||
libraries. See the question above for help on this.
|
||||
</itemize>
|
||||
<p>
|
||||
If none of the above help, then have a look in config.log, which is
|
||||
generated by ./configure as it runs. At the bottom will be the last
|
||||
action it took before failing. If it is a section of source code, copy
|
||||
the source code to a file and compile it with the line just above it in
|
||||
config.log. If the compilation is successful, try executing it.
|
||||
|
||||
<!-- ***************************************************************** -->
|
||||
<sect>Development of GTK+
|
||||
<!-- ***************************************************************** -->
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>When will it reach version 1.0?
|
||||
<p>
|
||||
The file 'TODO' in the gtk+ distribution lists the things that need to be done
|
||||
before version 1.0 is repleased. Not including bugs, this includes:
|
||||
|
||||
<itemize>
|
||||
<item>New Features
|
||||
<itemize>
|
||||
<item>gdk_expose_compress: ala-Xt, this would really help for opaque moves and
|
||||
such
|
||||
</itemize>
|
||||
<p>
|
||||
|
||||
<item>Widgets
|
||||
<itemize>
|
||||
<item>Column-list (Jay Painter)
|
||||
<item>Text widget (needs to be finished)
|
||||
<item>Entry should have a password mode (and it should show stars
|
||||
for user feedback)
|
||||
</itemize>
|
||||
<p>
|
||||
|
||||
<item>Drag-and-Drop (DND)
|
||||
<itemize>
|
||||
<item> It seems to be having problems again. The way DND data types are set in
|
||||
GtkWidget really needs to be fixed. This is pretty high on my priority
|
||||
list, and I'll get to it as soon as the column list widget is done. The
|
||||
correct way dnd data needs to be set is to have a additional keyed data
|
||||
type with GtkWidget, which is applied to the widget's window upon realize.
|
||||
There also needs to be a way to set dnd-data on widget windows which are
|
||||
not the main window (for widgets that create more than one window).
|
||||
-- Jay Painter
|
||||
<item> DnD seems to work for me, but yes, there needs to be some sort of
|
||||
gtk_widget layer that makes it easier... Also, adding support for drop
|
||||
zones might be nice.
|
||||
-- Elliot
|
||||
</itemize>
|
||||
</itemize>
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>Whats this CVS thing that everyone keeps talking about, and how do I access it?
|
||||
<p>
|
||||
@@ -327,7 +387,7 @@ and then generate a patch in the form of a 'context diff'. This can be done
|
||||
using a command such as <tt/diff -ru <oldfile> <newfile>/.
|
||||
Then upload the patchfile to:
|
||||
<verb>
|
||||
ftp://ftp.gimp.org/incoming
|
||||
ftp://ftp.gtk.org/incoming
|
||||
</verb>
|
||||
along with a README file. Make sure you follow the naming conventions or your
|
||||
patch will just be deleted! The filenames should be of this form:
|
||||
@@ -344,12 +404,12 @@ Example:
|
||||
gtk-gale-982701-0.patch.gz
|
||||
gtk-gale-982701-0.patch.README
|
||||
</verb>
|
||||
Once you upload <em>anything</em>, send the README to ftp-admin@gimp.org
|
||||
Once you upload <em>anything</em>, send the README to ftp-admin@gtk.org
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>How do I know if my patch got applied, and if not, why not?
|
||||
<p>
|
||||
Uploaded patches will be moved to <tt>ftp://ftp.gimp.org/pub/gtk/patches</tt>
|
||||
Uploaded patches will be moved to <tt>ftp://ftp.gtk.org/pub/gtk/patches</tt>
|
||||
where one of the GTK+ development team will pick them up. If applied, they
|
||||
will be moved to <tt>/pub/gtk/patches/old</tt>.
|
||||
|
||||
@@ -374,13 +434,11 @@ gladly be included.
|
||||
Yes. There is
|
||||
<itemize>
|
||||
<item>a C++ wrapper for GTK+ called gtk--. You can find the home page at:
|
||||
<verb>
|
||||
http://www.cs.tut.fi/~p150650/gtk/gtk--.html
|
||||
</verb>
|
||||
The FTP site is:
|
||||
<verb>
|
||||
ftp://ftp.gimp.org/pub/gtk/gtk--/
|
||||
</verb>
|
||||
<htmlurl url="http://www.cs.tut.fi/~p150650/gtk/gtk--.html"
|
||||
name="http://www.cs.tut.fi/~p150650/gtk/gtk--.html">.
|
||||
The FTP site is
|
||||
<htmlurl url="ftp://ftp.gtk.org/pub/gtk/gtk--"
|
||||
name="ftp://ftp.gtk.org/pub/gtk/gtk--">.
|
||||
<p>
|
||||
|
||||
<item>There are two Objective-c bindings currently in development:
|
||||
@@ -395,7 +453,7 @@ ftp://ftp.gimp.org/pub/gtk/gtk--/
|
||||
<item>If you are more inclined towards the
|
||||
<htmlurl url="http://www.gnustep.org/" name="GNUstep project">,
|
||||
you may want to check out GTKKit by
|
||||
<htmlurl url="mailto:helge@mdlink.de" name="Helge Heszlig">.
|
||||
<htmlurl url="mailto:helge@mdlink.de" name="Helge Heß">.
|
||||
The intention is to setup a GTK+ binding using the FoundationKit.
|
||||
GTKKit includes nicities like writing a XML-type template file to
|
||||
construct a GTK+ interface.
|
||||
@@ -403,14 +461,12 @@ ftp://ftp.gimp.org/pub/gtk/gtk--/
|
||||
</itemize>
|
||||
<p>
|
||||
<item>Perl bindings
|
||||
<verb>
|
||||
ftp://ftp.gimp.org/pub/gtk/perl
|
||||
</verb>
|
||||
|
||||
<item>Guile bindings. The home page is at:
|
||||
<verb>
|
||||
http://www.ping.de/sites/zagadka/guile-gtk/
|
||||
</verb>
|
||||
<htmlurl url="ftp://ftp.gtk.org/pub/gtk/perl"
|
||||
name="ftp://ftp.gtk.org/pub/gtk/perl">
|
||||
<P>
|
||||
<item>Guile bindings. The home page is at
|
||||
<htmlurl url="http://www.ping.de/sites/zagadka/guile-gtk"
|
||||
name="http://www.ping.de/sites/zagadka/guile-gtk">.
|
||||
By the way, Guile is the GNU Project's implemention of R4RS Scheme (the
|
||||
standard). If you like Scheme, you may want to take a look at this.
|
||||
<p>
|
||||
@@ -420,24 +476,28 @@ standard). If you like Scheme, you may want to take a look at this.
|
||||
The basics of the system, including callbacks, work fine.
|
||||
|
||||
The current development is in
|
||||
http://www.ens-lyon.fr/~dmonniau/arcs/
|
||||
<htmlurl url="http://www.ens-lyon.fr/~dmonniau/arcs"
|
||||
name="http://www.ens-lyon.fr/~dmonniau/arcs">
|
||||
</quote>
|
||||
|
||||
<item>
|
||||
Several python-gtk interfaces have been done. python-gtk is at:
|
||||
<verb>
|
||||
http://www.acs.ucalgary.cs/~nashceme/python-gtk/
|
||||
</verb>
|
||||
If you try python-gtk and don't like it, there's also pygtk located at:
|
||||
<verb>
|
||||
ftp://ftp.gimp.org/pub/gtk/python/
|
||||
</verb>
|
||||
|
||||
Several python bindings have been done:
|
||||
<p>
|
||||
<itemize>
|
||||
<item>pygtk is at
|
||||
<htmlurl url="http://www.daa.com.au/~james/pygtk"
|
||||
name="http://www.daa.com.au/~james/pygtk"> and
|
||||
<htmlurl url="ftp://ftp.gtk.org/pub/gtk/python"
|
||||
name="ftp://ftp.gtk.org/pub/gtk/python">
|
||||
<item>python-gtk is at
|
||||
<htmlurl url="http://www.ucalgary.ca/~nascheme/python-gtk"
|
||||
name="http://www.ucalgary.ca/~nascheme/python-gtk">
|
||||
</itemize>
|
||||
<p>
|
||||
<item>
|
||||
There's a OpenGL/Mesa widget available for GTK+. Grab it at:
|
||||
<verb>
|
||||
http://www.sakuranet.or.jp/~aozasa/shige/doc/comp/gtk/gtkGL/files-en.html
|
||||
</verb>
|
||||
There's a OpenGL/Mesa widget available for GTK+. Grab it at
|
||||
<htmlurl url="http://www.sakuranet.or.jp/~aozasa/shige/doc/comp/gtk/gtkGL/files-en.html"
|
||||
name="http://www.sakuranet.or.jp/~aozasa/shige/doc/comp/gtk/gtkGL/files-en.html">
|
||||
|
||||
</itemize>
|
||||
|
||||
@@ -449,9 +509,9 @@ http://www.sakuranet.or.jp/~aozasa/shige/doc/comp/gtk/gtkGL/files-en.html
|
||||
<p>
|
||||
So, after you have installed GTK+ there are a couple of things that can
|
||||
ease you into developing applications with it. There is the
|
||||
GTK+ Tutorial <htmlurl url="http://www.levien.com/~slow/gtk/tutorial"
|
||||
name="<http://www.levien.com/~slow/gtk/tutorial>">, which is undergoing development. This will introduce you
|
||||
to writing applications using C.
|
||||
GTK+ Tutorial <htmlurl url="http://www.gtk.org/tutorial/"
|
||||
name="<http://www.gtk.org/tutorial/>">, which is undergoing
|
||||
development. This will introduce you to writing applications using C.
|
||||
|
||||
The Tutorial doesn't (yet) contain information on all of the widgets
|
||||
that are in GTK+. For example code on how to use the basics of all the
|
||||
@@ -503,6 +563,7 @@ The GTK+ Tutorial lists the following widgets:
|
||||
| | `GtkCheckButton
|
||||
| | `GtkRadioButton
|
||||
| +GtkCList
|
||||
| `GtkCTree
|
||||
| +GtkFixed
|
||||
| +GtkList
|
||||
| +GtkMenuShell
|
||||
@@ -545,6 +606,58 @@ The GTK+ Tutorial lists the following widgets:
|
||||
`GtkVSeparator
|
||||
</verb>
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>Is GTK+ thread safe? How do I write multi-threaded GTK+ applications?
|
||||
<p>
|
||||
Although GTK+, like many X toolkits, isn't thread safe, this does
|
||||
not prohibit the development of multi-threaded applications with
|
||||
GTK+.
|
||||
|
||||
Rob Browning (rlb@cs.utexas.edu) describes threading techniques for
|
||||
use with GTK+ (slightly edited):
|
||||
|
||||
There are basically two main approaches, the first is simple, and the
|
||||
second complicated. In the first, you just make sure that all GTK+ (or
|
||||
X) interactions are handled by one, and
|
||||
only one, thread. Any other thread that wants to draw something has
|
||||
to somehow notify the "GTK+" thread, and let it handle the
|
||||
actual work.
|
||||
|
||||
The second approach allows you to call GTK+ (or X) functions from any
|
||||
thread, but it requires some careful synchronization. The
|
||||
basic idea is that you create an X protection mutex, and no one may
|
||||
make any X calls without first acquiring this mutex.
|
||||
|
||||
Note that this is a little effort, but it allows you to be
|
||||
potentially more efficient than a completely thread safe GTK+. You
|
||||
get to decide the granularity of the thread locking. You also have to
|
||||
make sure that the thread that calls gtk_main is holding the lock when
|
||||
it calls gtk_main.
|
||||
|
||||
The next thing to worry about is that since you were holding the
|
||||
global mutex when you entered gtk_main, all callbacks will also be
|
||||
holding it. This means that the callback must release it if it's
|
||||
going to call any other code that might reacquire it. Otherwise
|
||||
you'll get deadlock. Also, you must be holding the mutex when you
|
||||
finally return from the callback.
|
||||
|
||||
In order to allow threads other than the one calling gtk_main to
|
||||
get access to the mutex, we also need to register a work function
|
||||
with GTK that allows us to release the mutex periodically.
|
||||
|
||||
Why can't GTK+ be thread safe by default?
|
||||
|
||||
Complexity, overhead, and manpower. The proportion of threaded
|
||||
programs is still reasonably small, and getting thread safety right is
|
||||
both quite difficult and takes valuable time away from the main work
|
||||
of getting a good graphics library finished. It would be nice to have
|
||||
GTK+ thread safe "out of the box", but that's not practical right now,
|
||||
and it also might make GTK+ substantially less efficient if not handled
|
||||
carefully.
|
||||
|
||||
Regardless, it's especially not a priority since relatively good
|
||||
workarounds exist.
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>How can I prevent redrawing and resizing while I change multiple widgets?
|
||||
<p>
|
||||
@@ -553,7 +666,7 @@ code where you are changing a lot of stuff. This will result in much faster
|
||||
speed since it will prevent resizing of the entire widget hierarchy.
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>How do I catch a double click event in a list widget?
|
||||
<sect1>How do I catch a double click event (in a list widget, for example)?
|
||||
<p>
|
||||
Tim Janik wrote to gtk-list (slightly modified):
|
||||
|
||||
@@ -596,7 +709,15 @@ And connect the handler to your object:
|
||||
/* something else */
|
||||
}
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
and, Owen Taylor wrote:
|
||||
|
||||
Note that a single button press will be received beforehand, and
|
||||
if you are doing this for a button, you will therefore also get a
|
||||
"clicked" signal for the button. (This is going to be true for
|
||||
any toolkit, since computers aren't good at reading one's
|
||||
mind.)
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>How do I find out about the selection of a GtkList?
|
||||
<p>
|
||||
@@ -752,7 +873,7 @@ determined it didn't look good and removed it.
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>How can I define a separation line in a menu?
|
||||
<p>
|
||||
See the <htmlurl url="http://www.levien.com/~slow/gtk/"
|
||||
See the <htmlurl url="http://www.gtk.org/tutorial/"
|
||||
name="Tutorial"> for information on how to create menus.
|
||||
However, to create a separation line in a menu, just insert an
|
||||
empty menu item:
|
||||
@@ -772,6 +893,31 @@ Use something like the following:
|
||||
menu_path = gtk_menu_factory_find (factory, "<MyApp>/Help");
|
||||
gtk_menu_item_right_justify(menu_path->widget);
|
||||
</verb></tscreen>
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>How do I make my window modal? / How do I make a single window active?
|
||||
<p>
|
||||
After you create your window, do gtk_grab_add(my_window). And after
|
||||
closing the window do gtk_grab_remove(my_window).
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>Why doesn't my widget (e.g. progressbar) update?
|
||||
<p>
|
||||
|
||||
You are probably doing all the changes within a function
|
||||
without returning control to gtk_main. Most drawing updates are only
|
||||
placed on a queue, which is processed within gtk_main. You can
|
||||
force the drawing queue to be processed using something like:
|
||||
|
||||
<tscreen><verb>
|
||||
while (gtk_events_pending())
|
||||
gtk_main_iteration();
|
||||
</verb></tscreen>
|
||||
|
||||
inside you're function that changes the widget.
|
||||
|
||||
What the above snippet does is run all pending events and high priority
|
||||
idle functions, then return immediately (the drawing is done in a
|
||||
high priority idle function).
|
||||
|
||||
<!-- ***************************************************************** -->
|
||||
<sect>About gdk
|
||||
|
||||
9969
docs/tutorial/gtk_tut.sgml
Normal file
9969
docs/tutorial/gtk_tut.sgml
Normal file
File diff suppressed because it is too large
Load Diff
10090
docs/tutorial/gtk_tut_it.sgml
Normal file
10090
docs/tutorial/gtk_tut_it.sgml
Normal file
File diff suppressed because it is too large
Load Diff
BIN
docs/tutorial/gtk_tut_packbox1.gif
Normal file
BIN
docs/tutorial/gtk_tut_packbox1.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
BIN
docs/tutorial/gtk_tut_packbox2.gif
Normal file
BIN
docs/tutorial/gtk_tut_packbox2.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
BIN
docs/tutorial/gtk_tut_table.gif
Normal file
BIN
docs/tutorial/gtk_tut_table.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
@@ -333,8 +333,7 @@ Removing from a container
|
||||
When a widget is removed to a container, the container:
|
||||
|
||||
1) Calls gtk_widget_unparent (widget)
|
||||
2) Sets widget->parent to NULL
|
||||
3) Queues a resize.
|
||||
2) Queues a resize.
|
||||
|
||||
Notes:
|
||||
|
||||
@@ -378,7 +377,7 @@ The Map signal
|
||||
|
||||
1) Set the MAPPED flag
|
||||
2) If the widget has any windows, gdk_window_show those windows
|
||||
3) call gtk_widget_map for all child windows that are
|
||||
3) call gtk_widget_map for all child widgets that are
|
||||
VISIBLE and !MAPPED.
|
||||
3) Do any other functions related to putting the widget onscreen.
|
||||
(for instance, showing extra popup windows...)
|
||||
|
||||
8
examples/aspectframe/Makefile
Normal file
8
examples/aspectframe/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
aspectframe: aspectframe.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` aspectframe.c -o aspectframe
|
||||
|
||||
clean:
|
||||
rm -f *.o aspectframe
|
||||
43
examples/aspectframe/aspectframe.c
Normal file
43
examples/aspectframe/aspectframe.c
Normal file
@@ -0,0 +1,43 @@
|
||||
/* aspectframe.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *aspect_frame;
|
||||
GtkWidget *drawing_area;
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame");
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
/* Create an aspect_frame and add it to our toplevel window */
|
||||
|
||||
aspect_frame = gtk_aspect_frame_new ("2x1", /* label */
|
||||
0.5, /* center x */
|
||||
0.5, /* center y */
|
||||
2, /* xsize/ysize = 2 */
|
||||
FALSE /* ignore child's aspect */);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER(window), aspect_frame);
|
||||
gtk_widget_show (aspect_frame);
|
||||
|
||||
/* Now add a child widget to the aspect frame */
|
||||
|
||||
drawing_area = gtk_drawing_area_new ();
|
||||
|
||||
/* Ask for a 200x200 window, but the AspectFrame will give us a 200x100
|
||||
* window since we are forcing a 2x1 aspect ratio */
|
||||
gtk_widget_set_usize (drawing_area, 200, 200);
|
||||
gtk_container_add (GTK_CONTAINER(aspect_frame), drawing_area);
|
||||
gtk_widget_show (drawing_area);
|
||||
|
||||
gtk_widget_show (window);
|
||||
gtk_main ();
|
||||
return 0;
|
||||
}
|
||||
8
examples/buttons/Makefile
Normal file
8
examples/buttons/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
buttons: buttons.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` buttons.c -o buttons
|
||||
|
||||
clean:
|
||||
rm -f *.o buttons
|
||||
106
examples/buttons/buttons.c
Normal file
106
examples/buttons/buttons.c
Normal file
@@ -0,0 +1,106 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* buttons.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* create a new hbox with an image and a label packed into it
|
||||
* and return the box.. */
|
||||
|
||||
GtkWidget *xpm_label_box (GtkWidget *parent, gchar *xpm_filename, gchar *label_text)
|
||||
{
|
||||
GtkWidget *box1;
|
||||
GtkWidget *label;
|
||||
GtkWidget *pixmapwid;
|
||||
GdkPixmap *pixmap;
|
||||
GdkBitmap *mask;
|
||||
GtkStyle *style;
|
||||
|
||||
/* create box for xpm and label */
|
||||
box1 = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_border_width (GTK_CONTAINER (box1), 2);
|
||||
|
||||
/* get style of button.. I assume it's to get the background color.
|
||||
* if someone knows the real reason, please enlighten me. */
|
||||
style = gtk_widget_get_style(parent);
|
||||
|
||||
/* now on to the xpm stuff.. load xpm */
|
||||
pixmap = gdk_pixmap_create_from_xpm (parent->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
xpm_filename);
|
||||
pixmapwid = gtk_pixmap_new (pixmap, mask);
|
||||
|
||||
/* create label for button */
|
||||
label = gtk_label_new (label_text);
|
||||
|
||||
/* pack the pixmap and label into the box */
|
||||
gtk_box_pack_start (GTK_BOX (box1),
|
||||
pixmapwid, FALSE, FALSE, 3);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 3);
|
||||
|
||||
gtk_widget_show(pixmapwid);
|
||||
gtk_widget_show(label);
|
||||
|
||||
return (box1);
|
||||
}
|
||||
|
||||
/* our usual callback function */
|
||||
void callback (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
g_print ("Hello again - %s was pressed\n", (char *) data);
|
||||
}
|
||||
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
/* GtkWidget is the storage type for widgets */
|
||||
GtkWidget *window;
|
||||
GtkWidget *button;
|
||||
GtkWidget *box1;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* create a new window */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Pixmap'd Buttons!");
|
||||
|
||||
/* It's a good idea to do this for all windows. */
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_exit), NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (gtk_exit), NULL);
|
||||
|
||||
|
||||
/* sets the border width of the window. */
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
gtk_widget_realize(window);
|
||||
|
||||
/* create a new button */
|
||||
button = gtk_button_new ();
|
||||
|
||||
/* You should be getting used to seeing most of these functions by now */
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (callback), (gpointer) "cool button");
|
||||
|
||||
/* this calls our box creating function */
|
||||
box1 = xpm_label_box(window, "info.xpm", "cool button");
|
||||
|
||||
/* pack and show all our widgets */
|
||||
gtk_widget_show(box1);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (button), box1);
|
||||
|
||||
gtk_widget_show(button);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), button);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
/* rest in gtk_main and wait for the fun to begin! */
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
92
examples/buttons/info.xpm
Normal file
92
examples/buttons/info.xpm
Normal file
@@ -0,0 +1,92 @@
|
||||
/* XPM */
|
||||
static char *openfile[] = {
|
||||
/* width height num_colors chars_per_pixel */
|
||||
" 20 19 66 2",
|
||||
/* colors */
|
||||
".. c None",
|
||||
".# c #000000",
|
||||
".a c #dfdfdf",
|
||||
".b c #7f7f7f",
|
||||
".c c #006f6f",
|
||||
".d c #00efef",
|
||||
".e c #009f9f",
|
||||
".f c #004040",
|
||||
".g c #00bfbf",
|
||||
".h c #ff0000",
|
||||
".i c #ffffff",
|
||||
".j c #7f0000",
|
||||
".k c #007070",
|
||||
".l c #00ffff",
|
||||
".m c #00a0a0",
|
||||
".n c #004f4f",
|
||||
".o c #00cfcf",
|
||||
".p c #8f8f8f",
|
||||
".q c #6f6f6f",
|
||||
".r c #a0a0a0",
|
||||
".s c #7f7f00",
|
||||
".t c #007f7f",
|
||||
".u c #5f5f5f",
|
||||
".v c #707070",
|
||||
".w c #00f0f0",
|
||||
".x c #009090",
|
||||
".y c #ffff00",
|
||||
".z c #0000ff",
|
||||
".A c #00afaf",
|
||||
".B c #00d0d0",
|
||||
".C c #00dfdf",
|
||||
".D c #005f5f",
|
||||
".E c #00b0b0",
|
||||
".F c #001010",
|
||||
".G c #00c0c0",
|
||||
".H c #000f0f",
|
||||
".I c #00007f",
|
||||
".J c #005050",
|
||||
".K c #002f2f",
|
||||
".L c #dfcfcf",
|
||||
".M c #dfd0d0",
|
||||
".N c #006060",
|
||||
".O c #00e0e0",
|
||||
".P c #00ff00",
|
||||
".Q c #002020",
|
||||
".R c #dfc0c0",
|
||||
".S c #008080",
|
||||
".T c #001f1f",
|
||||
".U c #003f3f",
|
||||
".V c #007f00",
|
||||
".W c #00000f",
|
||||
".X c #000010",
|
||||
".Y c #00001f",
|
||||
".Z c #000020",
|
||||
".0 c #00002f",
|
||||
".1 c #000030",
|
||||
".2 c #00003f",
|
||||
".3 c #000040",
|
||||
".4 c #00004f",
|
||||
".5 c #000050",
|
||||
".6 c #00005f",
|
||||
".7 c #000060",
|
||||
".8 c #00006f",
|
||||
".9 c #000070",
|
||||
"#. c #7f7f80",
|
||||
"## c #9f9f9f",
|
||||
/* pixels */
|
||||
"........................................",
|
||||
"........................................",
|
||||
"........................................",
|
||||
".......................#.#.#............",
|
||||
".....................#.......#...#......",
|
||||
"...............................#.#......",
|
||||
".......#.#.#.................#.#.#......",
|
||||
".....#.y.i.y.#.#.#.#.#.#.#..............",
|
||||
".....#.i.y.i.y.i.y.i.y.i.#..............",
|
||||
".....#.y.i.y.i.y.i.y.i.y.#..............",
|
||||
".....#.i.y.i.y.#.#.#.#.#.#.#.#.#.#.#....",
|
||||
".....#.y.i.y.#.s.s.s.s.s.s.s.s.s.#......",
|
||||
".....#.i.y.#.s.s.s.s.s.s.s.s.s.#........",
|
||||
".....#.y.#.s.s.s.s.s.s.s.s.s.#..........",
|
||||
".....#.#.s.s.s.s.s.s.s.s.s.#............",
|
||||
".....#.#.#.#.#.#.#.#.#.#.#..............",
|
||||
"........................................",
|
||||
"........................................",
|
||||
"........................................"
|
||||
};
|
||||
8
examples/entry/Makefile
Normal file
8
examples/entry/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
entry: entry.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` entry.c -o entry
|
||||
|
||||
clean:
|
||||
rm -f *.o entry
|
||||
92
examples/entry/entry.c
Normal file
92
examples/entry/entry.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* entry.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
void enter_callback(GtkWidget *widget, GtkWidget *entry)
|
||||
{
|
||||
gchar *entry_text;
|
||||
entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
|
||||
printf("Entry contents: %s\n", entry_text);
|
||||
}
|
||||
|
||||
void entry_toggle_editable (GtkWidget *checkbutton,
|
||||
GtkWidget *entry)
|
||||
{
|
||||
gtk_entry_set_editable(GTK_ENTRY(entry),
|
||||
GTK_TOGGLE_BUTTON(checkbutton)->active);
|
||||
}
|
||||
|
||||
void entry_toggle_visibility (GtkWidget *checkbutton,
|
||||
GtkWidget *entry)
|
||||
{
|
||||
gtk_entry_set_visibility(GTK_ENTRY(entry),
|
||||
GTK_TOGGLE_BUTTON(checkbutton)->active);
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox, *hbox;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *button;
|
||||
GtkWidget *check;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* create a new window */
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_usize( GTK_WIDGET (window), 200, 100);
|
||||
gtk_window_set_title(GTK_WINDOW (window), "GTK Entry");
|
||||
gtk_signal_connect(GTK_OBJECT (window), "delete_event",
|
||||
(GtkSignalFunc) gtk_exit, NULL);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
entry = gtk_entry_new_with_max_length (50);
|
||||
gtk_signal_connect(GTK_OBJECT(entry), "activate",
|
||||
GTK_SIGNAL_FUNC(enter_callback),
|
||||
entry);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), "hello");
|
||||
gtk_entry_append_text (GTK_ENTRY (entry), " world");
|
||||
gtk_entry_select_region (GTK_ENTRY (entry),
|
||||
0, GTK_ENTRY(entry)->text_length);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0);
|
||||
gtk_widget_show (entry);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
check = gtk_check_button_new_with_label("Editable");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), check, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT(check), "toggled",
|
||||
GTK_SIGNAL_FUNC(entry_toggle_editable), entry);
|
||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(check), TRUE);
|
||||
gtk_widget_show (check);
|
||||
|
||||
check = gtk_check_button_new_with_label("Visible");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), check, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT(check), "toggled",
|
||||
GTK_SIGNAL_FUNC(entry_toggle_visibility), entry);
|
||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(check), TRUE);
|
||||
gtk_widget_show (check);
|
||||
|
||||
button = gtk_button_new_with_label ("Close");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_exit),
|
||||
GTK_OBJECT (window));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_show(window);
|
||||
|
||||
gtk_main();
|
||||
return(0);
|
||||
}
|
||||
8
examples/eventbox/Makefile
Normal file
8
examples/eventbox/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
eventbox: eventbox.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` eventbox.c -o eventbox
|
||||
|
||||
clean:
|
||||
rm -f *.o eventbox
|
||||
55
examples/eventbox/eventbox.c
Normal file
55
examples/eventbox/eventbox.c
Normal file
@@ -0,0 +1,55 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* eventbox.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *event_box;
|
||||
GtkWidget *label;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Event Box");
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_exit), NULL);
|
||||
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
/* Create an EventBox and add it to our toplevel window */
|
||||
|
||||
event_box = gtk_event_box_new ();
|
||||
gtk_container_add (GTK_CONTAINER(window), event_box);
|
||||
gtk_widget_show (event_box);
|
||||
|
||||
/* Create a long label */
|
||||
|
||||
label = gtk_label_new ("Click here to quit, quit, quit, quit, quit");
|
||||
gtk_container_add (GTK_CONTAINER (event_box), label);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Clip it short. */
|
||||
gtk_widget_set_usize (label, 110, 20);
|
||||
|
||||
/* And bind an action to it */
|
||||
gtk_widget_set_events (event_box, GDK_BUTTON_PRESS_MASK);
|
||||
gtk_signal_connect (GTK_OBJECT(event_box), "button_press_event",
|
||||
GTK_SIGNAL_FUNC (gtk_exit), NULL);
|
||||
|
||||
/* Yet one more thing you need an X window for ... */
|
||||
|
||||
gtk_widget_realize (event_box);
|
||||
gdk_window_set_cursor (event_box->window, gdk_cursor_new (GDK_HAND1));
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
8
examples/filesel/Makefile
Normal file
8
examples/filesel/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
filesel: filesel.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` filesel.c -o filesel
|
||||
|
||||
clean:
|
||||
rm -f *.o filesel
|
||||
46
examples/filesel/filesel.c
Normal file
46
examples/filesel/filesel.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* filesel.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Get the selected filename and print it to the console */
|
||||
void file_ok_sel (GtkWidget *w, GtkFileSelection *fs)
|
||||
{
|
||||
g_print ("%s\n", gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
|
||||
}
|
||||
|
||||
void destroy (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *filew;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* Create a new file selection widget */
|
||||
filew = gtk_file_selection_new ("File selection");
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (filew), "destroy",
|
||||
(GtkSignalFunc) destroy, &filew);
|
||||
/* Connect the ok_button to file_ok_sel function */
|
||||
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
|
||||
"clicked", (GtkSignalFunc) file_ok_sel, filew );
|
||||
|
||||
/* Connect the cancel_button to destroy the widget */
|
||||
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button),
|
||||
"clicked", (GtkSignalFunc) gtk_widget_destroy,
|
||||
GTK_OBJECT (filew));
|
||||
|
||||
/* Lets set the filename, as if this were a save dialog, and we are giving
|
||||
a default filename */
|
||||
gtk_file_selection_set_filename (GTK_FILE_SELECTION(filew),
|
||||
"penguin.png");
|
||||
|
||||
gtk_widget_show(filew);
|
||||
gtk_main ();
|
||||
return 0;
|
||||
}
|
||||
4
examples/find-examples.sh
Executable file
4
examples/find-examples.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
find . -name CVS -prune -o \
|
||||
-not \( -type d -o -name Makefile.am -o -name find-examples.sh \) -print |
|
||||
sed 's%\./\(.*\)% examples/\1 \\%'
|
||||
echo " examples/find-examples.sh"
|
||||
14
examples/gtkdial/Makefile
Normal file
14
examples/gtkdial/Makefile
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
dial_test: gtkdial.o dial_test.o
|
||||
$(CC) `gtk-config --libs` dial_test.o gtkdial.o -o dial_test
|
||||
|
||||
dial_test.o: dial_test.c gtkdial.h
|
||||
$(CC) `gtk-config --cflags` -c dial_test.c -o dial_test.o
|
||||
|
||||
gtkdial.o: gtkdial.c gtkdial.h
|
||||
$(CC) `gtk-config --cflags` -c gtkdial.c -o gtkdial.o
|
||||
|
||||
clean:
|
||||
rm -f *.o dial_test
|
||||
64
examples/gtkdial/dial_test.c
Normal file
64
examples/gtkdial/dial_test.c
Normal file
@@ -0,0 +1,64 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkdial.h"
|
||||
|
||||
void
|
||||
value_changed (GtkAdjustment *adjustment, GtkWidget *label)
|
||||
{
|
||||
char buffer[16];
|
||||
|
||||
sprintf(buffer,"%4.2f",adjustment->value);
|
||||
gtk_label_set (GTK_LABEL (label), buffer);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkAdjustment *adjustment;
|
||||
GtkWidget *dial;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *label;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Dial");
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_exit), NULL);
|
||||
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_widget_show(vbox);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_start (GTK_BOX(vbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
adjustment = GTK_ADJUSTMENT(gtk_adjustment_new (0, -1.0, 1.0, 0.01, 0.1, 0));
|
||||
|
||||
dial = gtk_dial_new(adjustment);
|
||||
gtk_dial_set_update_policy (GTK_DIAL(dial), GTK_UPDATE_DELAYED);
|
||||
/* gtk_widget_set_usize (dial, 100, 100); */
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), dial);
|
||||
gtk_widget_show (dial);
|
||||
|
||||
label = gtk_label_new("0.00");
|
||||
gtk_box_pack_start (GTK_BOX(vbox), label, TRUE, TRUE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT(adjustment), "value_changed",
|
||||
GTK_SIGNAL_FUNC (value_changed), label);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
591
examples/gtkdial/gtkdial.c
Normal file
591
examples/gtkdial/gtkdial.c
Normal file
@@ -0,0 +1,591 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtkmain.h>
|
||||
#include <gtk/gtksignal.h>
|
||||
|
||||
#include "gtkdial.h"
|
||||
|
||||
#define SCROLL_DELAY_LENGTH 300
|
||||
#define DIAL_DEFAULT_SIZE 100
|
||||
|
||||
/* Forward declararations */
|
||||
|
||||
static void gtk_dial_class_init (GtkDialClass *klass);
|
||||
static void gtk_dial_init (GtkDial *dial);
|
||||
static void gtk_dial_destroy (GtkObject *object);
|
||||
static void gtk_dial_realize (GtkWidget *widget);
|
||||
static void gtk_dial_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void gtk_dial_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static gint gtk_dial_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
static gint gtk_dial_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event);
|
||||
static gint gtk_dial_button_release (GtkWidget *widget,
|
||||
GdkEventButton *event);
|
||||
static gint gtk_dial_motion_notify (GtkWidget *widget,
|
||||
GdkEventMotion *event);
|
||||
static gint gtk_dial_timer (GtkDial *dial);
|
||||
|
||||
static void gtk_dial_update_mouse (GtkDial *dial, gint x, gint y);
|
||||
static void gtk_dial_update (GtkDial *dial);
|
||||
static void gtk_dial_adjustment_changed (GtkAdjustment *adjustment,
|
||||
gpointer data);
|
||||
static void gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||
gpointer data);
|
||||
|
||||
/* Local data */
|
||||
|
||||
static GtkWidgetClass *parent_class = NULL;
|
||||
|
||||
guint
|
||||
gtk_dial_get_type ()
|
||||
{
|
||||
static guint dial_type = 0;
|
||||
|
||||
if (!dial_type)
|
||||
{
|
||||
GtkTypeInfo dial_info =
|
||||
{
|
||||
"GtkDial",
|
||||
sizeof (GtkDial),
|
||||
sizeof (GtkDialClass),
|
||||
(GtkClassInitFunc) gtk_dial_class_init,
|
||||
(GtkObjectInitFunc) gtk_dial_init,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
dial_type = gtk_type_unique (gtk_widget_get_type (), &dial_info);
|
||||
}
|
||||
|
||||
return dial_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_class_init (GtkDialClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
|
||||
object_class = (GtkObjectClass*) class;
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
|
||||
parent_class = gtk_type_class (gtk_widget_get_type ());
|
||||
|
||||
object_class->destroy = gtk_dial_destroy;
|
||||
|
||||
widget_class->realize = gtk_dial_realize;
|
||||
widget_class->expose_event = gtk_dial_expose;
|
||||
widget_class->size_request = gtk_dial_size_request;
|
||||
widget_class->size_allocate = gtk_dial_size_allocate;
|
||||
widget_class->button_press_event = gtk_dial_button_press;
|
||||
widget_class->button_release_event = gtk_dial_button_release;
|
||||
widget_class->motion_notify_event = gtk_dial_motion_notify;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_init (GtkDial *dial)
|
||||
{
|
||||
dial->button = 0;
|
||||
dial->policy = GTK_UPDATE_CONTINUOUS;
|
||||
dial->timer = 0;
|
||||
dial->radius = 0;
|
||||
dial->pointer_width = 0;
|
||||
dial->angle = 0.0;
|
||||
dial->old_value = 0.0;
|
||||
dial->old_lower = 0.0;
|
||||
dial->old_upper = 0.0;
|
||||
dial->adjustment = NULL;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
gtk_dial_new (GtkAdjustment *adjustment)
|
||||
{
|
||||
GtkDial *dial;
|
||||
|
||||
dial = gtk_type_new (gtk_dial_get_type ());
|
||||
|
||||
if (!adjustment)
|
||||
adjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
gtk_dial_set_adjustment (dial, adjustment);
|
||||
|
||||
return GTK_WIDGET (dial);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_destroy (GtkObject *object)
|
||||
{
|
||||
GtkDial *dial;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (object));
|
||||
|
||||
dial = GTK_DIAL (object);
|
||||
|
||||
if (dial->adjustment)
|
||||
gtk_object_unref (GTK_OBJECT (dial->adjustment));
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
}
|
||||
|
||||
GtkAdjustment*
|
||||
gtk_dial_get_adjustment (GtkDial *dial)
|
||||
{
|
||||
g_return_val_if_fail (dial != NULL, NULL);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (dial), NULL);
|
||||
|
||||
return dial->adjustment;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_dial_set_update_policy (GtkDial *dial,
|
||||
GtkUpdateType policy)
|
||||
{
|
||||
g_return_if_fail (dial != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (dial));
|
||||
|
||||
dial->policy = policy;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_dial_set_adjustment (GtkDial *dial,
|
||||
GtkAdjustment *adjustment)
|
||||
{
|
||||
g_return_if_fail (dial != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (dial));
|
||||
|
||||
if (dial->adjustment)
|
||||
{
|
||||
gtk_signal_disconnect_by_data (GTK_OBJECT (dial->adjustment), (gpointer) dial);
|
||||
gtk_object_unref (GTK_OBJECT (dial->adjustment));
|
||||
}
|
||||
|
||||
dial->adjustment = adjustment;
|
||||
gtk_object_ref (GTK_OBJECT (dial->adjustment));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (adjustment), "changed",
|
||||
(GtkSignalFunc) gtk_dial_adjustment_changed,
|
||||
(gpointer) dial);
|
||||
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
|
||||
(GtkSignalFunc) gtk_dial_adjustment_value_changed,
|
||||
(gpointer) dial);
|
||||
|
||||
dial->old_value = adjustment->value;
|
||||
dial->old_lower = adjustment->lower;
|
||||
dial->old_upper = adjustment->upper;
|
||||
|
||||
gtk_dial_update (dial);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_realize (GtkWidget *widget)
|
||||
{
|
||||
GtkDial *dial;
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (widget));
|
||||
|
||||
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
|
||||
dial = GTK_DIAL (widget);
|
||||
|
||||
attributes.x = widget->allocation.x;
|
||||
attributes.y = widget->allocation.y;
|
||||
attributes.width = widget->allocation.width;
|
||||
attributes.height = widget->allocation.height;
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.event_mask = gtk_widget_get_events (widget) |
|
||||
GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK |
|
||||
GDK_POINTER_MOTION_HINT_MASK;
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.colormap = gtk_widget_get_colormap (widget);
|
||||
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||
widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
|
||||
|
||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||
|
||||
gdk_window_set_user_data (widget->window, widget);
|
||||
|
||||
gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
requisition->width = DIAL_DEFAULT_SIZE;
|
||||
requisition->height = DIAL_DEFAULT_SIZE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkDial *dial;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (widget));
|
||||
g_return_if_fail (allocation != NULL);
|
||||
|
||||
widget->allocation = *allocation;
|
||||
dial = GTK_DIAL (widget);
|
||||
|
||||
if (GTK_WIDGET_REALIZED (widget))
|
||||
{
|
||||
|
||||
gdk_window_move_resize (widget->window,
|
||||
allocation->x, allocation->y,
|
||||
allocation->width, allocation->height);
|
||||
|
||||
}
|
||||
dial->radius = MIN(allocation->width,allocation->height) * 0.45;
|
||||
dial->pointer_width = dial->radius / 5;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_dial_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
GtkDial *dial;
|
||||
GdkPoint points[3];
|
||||
gdouble s,c;
|
||||
gdouble theta;
|
||||
gint xc, yc;
|
||||
gint tick_length;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
if (event->count > 0)
|
||||
return FALSE;
|
||||
|
||||
dial = GTK_DIAL (widget);
|
||||
|
||||
gdk_window_clear_area (widget->window,
|
||||
0, 0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
|
||||
xc = widget->allocation.width/2;
|
||||
yc = widget->allocation.height/2;
|
||||
|
||||
/* Draw ticks */
|
||||
|
||||
for (i=0; i<25; i++)
|
||||
{
|
||||
theta = (i*M_PI/18. - M_PI/6.);
|
||||
s = sin(theta);
|
||||
c = cos(theta);
|
||||
|
||||
tick_length = (i%6 == 0) ? dial->pointer_width : dial->pointer_width/2;
|
||||
|
||||
gdk_draw_line (widget->window,
|
||||
widget->style->fg_gc[widget->state],
|
||||
xc + c*(dial->radius - tick_length),
|
||||
yc - s*(dial->radius - tick_length),
|
||||
xc + c*dial->radius,
|
||||
yc - s*dial->radius);
|
||||
}
|
||||
|
||||
/* Draw pointer */
|
||||
|
||||
s = sin(dial->angle);
|
||||
c = cos(dial->angle);
|
||||
|
||||
|
||||
points[0].x = xc + s*dial->pointer_width/2;
|
||||
points[0].y = yc + c*dial->pointer_width/2;
|
||||
points[1].x = xc + c*dial->radius;
|
||||
points[1].y = yc - s*dial->radius;
|
||||
points[2].x = xc - s*dial->pointer_width/2;
|
||||
points[2].y = yc - c*dial->pointer_width/2;
|
||||
|
||||
gtk_draw_polygon (widget->style,
|
||||
widget->window,
|
||||
GTK_STATE_NORMAL,
|
||||
GTK_SHADOW_OUT,
|
||||
points, 3,
|
||||
TRUE);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_dial_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
GtkDial *dial;
|
||||
gint dx, dy;
|
||||
double s, c;
|
||||
double d_parallel;
|
||||
double d_perpendicular;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
dial = GTK_DIAL (widget);
|
||||
|
||||
/* Determine if button press was within pointer region - we
|
||||
do this by computing the parallel and perpendicular distance of
|
||||
the point where the mouse was pressed from the line passing through
|
||||
the pointer */
|
||||
|
||||
dx = event->x - widget->allocation.width / 2;
|
||||
dy = widget->allocation.height / 2 - event->y;
|
||||
|
||||
s = sin(dial->angle);
|
||||
c = cos(dial->angle);
|
||||
|
||||
d_parallel = s*dy + c*dx;
|
||||
d_perpendicular = fabs(s*dx - c*dy);
|
||||
|
||||
if (!dial->button &&
|
||||
(d_perpendicular < dial->pointer_width/2) &&
|
||||
(d_parallel > - dial->pointer_width))
|
||||
{
|
||||
gtk_grab_add (widget);
|
||||
|
||||
dial->button = event->button;
|
||||
|
||||
gtk_dial_update_mouse (dial, event->x, event->y);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_dial_button_release (GtkWidget *widget,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
GtkDial *dial;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
dial = GTK_DIAL (widget);
|
||||
|
||||
if (dial->button == event->button)
|
||||
{
|
||||
gtk_grab_remove (widget);
|
||||
|
||||
dial->button = 0;
|
||||
|
||||
if (dial->policy == GTK_UPDATE_DELAYED)
|
||||
gtk_timeout_remove (dial->timer);
|
||||
|
||||
if ((dial->policy != GTK_UPDATE_CONTINUOUS) &&
|
||||
(dial->old_value != dial->adjustment->value))
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_dial_motion_notify (GtkWidget *widget,
|
||||
GdkEventMotion *event)
|
||||
{
|
||||
GtkDial *dial;
|
||||
GdkModifierType mods;
|
||||
gint x, y, mask;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
dial = GTK_DIAL (widget);
|
||||
|
||||
if (dial->button != 0)
|
||||
{
|
||||
x = event->x;
|
||||
y = event->y;
|
||||
|
||||
if (event->is_hint || (event->window != widget->window))
|
||||
gdk_window_get_pointer (widget->window, &x, &y, &mods);
|
||||
|
||||
switch (dial->button)
|
||||
{
|
||||
case 1:
|
||||
mask = GDK_BUTTON1_MASK;
|
||||
break;
|
||||
case 2:
|
||||
mask = GDK_BUTTON2_MASK;
|
||||
break;
|
||||
case 3:
|
||||
mask = GDK_BUTTON3_MASK;
|
||||
break;
|
||||
default:
|
||||
mask = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (mods & mask)
|
||||
gtk_dial_update_mouse (dial, x,y);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_dial_timer (GtkDial *dial)
|
||||
{
|
||||
g_return_val_if_fail (dial != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (dial), FALSE);
|
||||
|
||||
if (dial->policy == GTK_UPDATE_DELAYED)
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_update_mouse (GtkDial *dial, gint x, gint y)
|
||||
{
|
||||
gint xc, yc;
|
||||
gfloat old_value;
|
||||
|
||||
g_return_if_fail (dial != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (dial));
|
||||
|
||||
xc = GTK_WIDGET(dial)->allocation.width / 2;
|
||||
yc = GTK_WIDGET(dial)->allocation.height / 2;
|
||||
|
||||
old_value = dial->adjustment->value;
|
||||
dial->angle = atan2(yc-y, x-xc);
|
||||
|
||||
if (dial->angle < -M_PI/2.)
|
||||
dial->angle += 2*M_PI;
|
||||
|
||||
if (dial->angle < -M_PI/6)
|
||||
dial->angle = -M_PI/6;
|
||||
|
||||
if (dial->angle > 7.*M_PI/6.)
|
||||
dial->angle = 7.*M_PI/6.;
|
||||
|
||||
dial->adjustment->value = dial->adjustment->lower + (7.*M_PI/6 - dial->angle) *
|
||||
(dial->adjustment->upper - dial->adjustment->lower) / (4.*M_PI/3.);
|
||||
|
||||
if (dial->adjustment->value != old_value)
|
||||
{
|
||||
if (dial->policy == GTK_UPDATE_CONTINUOUS)
|
||||
{
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_draw (GTK_WIDGET(dial), NULL);
|
||||
|
||||
if (dial->policy == GTK_UPDATE_DELAYED)
|
||||
{
|
||||
if (dial->timer)
|
||||
gtk_timeout_remove (dial->timer);
|
||||
|
||||
dial->timer = gtk_timeout_add (SCROLL_DELAY_LENGTH,
|
||||
(GtkFunction) gtk_dial_timer,
|
||||
(gpointer) dial);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_update (GtkDial *dial)
|
||||
{
|
||||
gfloat new_value;
|
||||
|
||||
g_return_if_fail (dial != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (dial));
|
||||
|
||||
new_value = dial->adjustment->value;
|
||||
|
||||
if (new_value < dial->adjustment->lower)
|
||||
new_value = dial->adjustment->lower;
|
||||
|
||||
if (new_value > dial->adjustment->upper)
|
||||
new_value = dial->adjustment->upper;
|
||||
|
||||
if (new_value != dial->adjustment->value)
|
||||
{
|
||||
dial->adjustment->value = new_value;
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
|
||||
}
|
||||
|
||||
dial->angle = 7.*M_PI/6. - (new_value - dial->adjustment->lower) * 4.*M_PI/3. /
|
||||
(dial->adjustment->upper - dial->adjustment->lower);
|
||||
|
||||
gtk_widget_draw (GTK_WIDGET(dial), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_adjustment_changed (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
{
|
||||
GtkDial *dial;
|
||||
|
||||
g_return_if_fail (adjustment != NULL);
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
dial = GTK_DIAL (data);
|
||||
|
||||
if ((dial->old_value != adjustment->value) ||
|
||||
(dial->old_lower != adjustment->lower) ||
|
||||
(dial->old_upper != adjustment->upper))
|
||||
{
|
||||
gtk_dial_update (dial);
|
||||
|
||||
dial->old_value = adjustment->value;
|
||||
dial->old_lower = adjustment->lower;
|
||||
dial->old_upper = adjustment->upper;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
{
|
||||
GtkDial *dial;
|
||||
|
||||
g_return_if_fail (adjustment != NULL);
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
dial = GTK_DIAL (data);
|
||||
|
||||
if (dial->old_value != adjustment->value)
|
||||
{
|
||||
gtk_dial_update (dial);
|
||||
|
||||
dial->old_value = adjustment->value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
89
examples/gtkdial/gtkdial.h
Normal file
89
examples/gtkdial/gtkdial.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef __GTK_DIAL_H__
|
||||
#define __GTK_DIAL_H__
|
||||
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtkadjustment.h>
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#define GTK_DIAL(obj) GTK_CHECK_CAST (obj, gtk_dial_get_type (), GtkDial)
|
||||
#define GTK_DIAL_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_dial_get_type (), GtkDialClass)
|
||||
#define GTK_IS_DIAL(obj) GTK_CHECK_TYPE (obj, gtk_dial_get_type ())
|
||||
|
||||
|
||||
typedef struct _GtkDial GtkDial;
|
||||
typedef struct _GtkDialClass GtkDialClass;
|
||||
|
||||
struct _GtkDial
|
||||
{
|
||||
GtkWidget widget;
|
||||
|
||||
/* update policy (GTK_UPDATE_[CONTINUOUS/DELAYED/DISCONTINUOUS]) */
|
||||
guint policy : 2;
|
||||
|
||||
/* Button currently pressed or 0 if none */
|
||||
guint8 button;
|
||||
|
||||
/* Dimensions of dial components */
|
||||
gint radius;
|
||||
gint pointer_width;
|
||||
|
||||
/* ID of update timer, or 0 if none */
|
||||
guint32 timer;
|
||||
|
||||
/* Current angle */
|
||||
gfloat angle;
|
||||
|
||||
/* Old values from adjustment stored so we know when something changes */
|
||||
gfloat old_value;
|
||||
gfloat old_lower;
|
||||
gfloat old_upper;
|
||||
|
||||
/* The adjustment object that stores the data for this dial */
|
||||
GtkAdjustment *adjustment;
|
||||
};
|
||||
|
||||
struct _GtkDialClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GtkWidget* gtk_dial_new (GtkAdjustment *adjustment);
|
||||
guint gtk_dial_get_type (void);
|
||||
GtkAdjustment* gtk_dial_get_adjustment (GtkDial *dial);
|
||||
void gtk_dial_set_update_policy (GtkDial *dial,
|
||||
GtkUpdateType policy);
|
||||
|
||||
void gtk_dial_set_adjustment (GtkDial *dial,
|
||||
GtkAdjustment *adjustment);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GTK_DIAL_H__ */
|
||||
8
examples/helloworld/Makefile
Normal file
8
examples/helloworld/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
helloworld: helloworld.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` helloworld.c -o helloworld
|
||||
|
||||
clean:
|
||||
rm -f helloworld
|
||||
97
examples/helloworld/helloworld.c
Normal file
97
examples/helloworld/helloworld.c
Normal file
@@ -0,0 +1,97 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* helloworld.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* this is a callback function. the data arguments are ignored in this example.
|
||||
* More on callbacks below. */
|
||||
void hello (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
g_print ("Hello World\n");
|
||||
}
|
||||
|
||||
|
||||
gint delete_event(GtkWidget *widget, GdkEvent *event, gpointer data)
|
||||
{
|
||||
g_print ("delete event occured\n");
|
||||
/* if you return FALSE in the "delete_event" signal handler,
|
||||
* GTK will emit the "destroy" signal. Returning TRUE means
|
||||
* you don't want the window to be destroyed.
|
||||
* This is useful for popping up 'are you sure you want to quit ?'
|
||||
* type dialogs. */
|
||||
|
||||
/* Change TRUE to FALSE and the main window will be destroyed with
|
||||
* a "delete_event". */
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/* another callback */
|
||||
void destroy (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
/* GtkWidget is the storage type for widgets */
|
||||
GtkWidget *window;
|
||||
GtkWidget *button;
|
||||
|
||||
/* this is called in all GTK applications. arguments are parsed from
|
||||
* the command line and are returned to the application. */
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* create a new window */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
/* when the window is given the "delete_event" signal (this is given
|
||||
* by the window manager (usually the 'close' option, or on the
|
||||
* titlebar), we ask it to call the delete_event () function
|
||||
* as defined above. The data passed to the callback
|
||||
* function is NULL and is ignored in the callback. */
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (delete_event), NULL);
|
||||
|
||||
/* here we connect the "destroy" event to a signal handler.
|
||||
* This event occurs when we call gtk_widget_destroy() on the window,
|
||||
* or if we return 'FALSE' in the "delete_event" callback. */
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (destroy), NULL);
|
||||
|
||||
/* sets the border width of the window. */
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
/* creates a new button with the label "Hello World". */
|
||||
button = gtk_button_new_with_label ("Hello World");
|
||||
|
||||
/* When the button receives the "clicked" signal, it will call the
|
||||
* function hello() passing it NULL as it's argument. The hello()
|
||||
* function is defined above. */
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (hello), NULL);
|
||||
|
||||
/* This will cause the window to be destroyed by calling
|
||||
* gtk_widget_destroy(window) when "clicked". Again, the destroy
|
||||
* signal could come from here, or the window manager. */
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
GTK_OBJECT (window));
|
||||
|
||||
/* this packs the button into the window (a gtk container). */
|
||||
gtk_container_add (GTK_CONTAINER (window), button);
|
||||
|
||||
/* the final step is to display this newly created widget... */
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* and the window */
|
||||
gtk_widget_show (window);
|
||||
|
||||
/* all GTK applications must have a gtk_main(). Control ends here
|
||||
* and waits for an event to occur (like a key press or mouse event). */
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
8
examples/helloworld2/Makefile
Normal file
8
examples/helloworld2/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
helloworld2: helloworld2.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` helloworld2.c -o helloworld2
|
||||
|
||||
clean:
|
||||
rm -f helloworld2
|
||||
94
examples/helloworld2/helloworld2.c
Normal file
94
examples/helloworld2/helloworld2.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* helloworld2.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Our new improved callback. The data passed to this function is printed
|
||||
* to stdout. */
|
||||
void callback (GtkWidget *widget, gpointer *data)
|
||||
{
|
||||
g_print ("Hello again - %s was pressed\n", (char *) data);
|
||||
}
|
||||
|
||||
/* another callback */
|
||||
void delete_event (GtkWidget *widget, GdkEvent *event, gpointer *data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
/* GtkWidget is the storage type for widgets */
|
||||
GtkWidget *window;
|
||||
GtkWidget *button;
|
||||
GtkWidget *box1;
|
||||
|
||||
/* this is called in all GTK applications. arguments are parsed from
|
||||
* the command line and are returned to the application. */
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* create a new window */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
/* this is a new call, this just sets the title of our
|
||||
* new window to "Hello Buttons!" */
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Hello Buttons!");
|
||||
|
||||
/* Here we just set a handler for delete_event that immediately
|
||||
* exits GTK. */
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (delete_event), NULL);
|
||||
|
||||
|
||||
/* sets the border width of the window. */
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
/* we create a box to pack widgets into. this is described in detail
|
||||
* in the "packing" section below. The box is not really visible, it
|
||||
* is just used as a tool to arrange widgets. */
|
||||
box1 = gtk_hbox_new(FALSE, 0);
|
||||
|
||||
/* put the box into the main window. */
|
||||
gtk_container_add (GTK_CONTAINER (window), box1);
|
||||
|
||||
/* creates a new button with the label "Button 1". */
|
||||
button = gtk_button_new_with_label ("Button 1");
|
||||
|
||||
/* Now when the button is clicked, we call the "callback" function
|
||||
* with a pointer to "button 1" as it's argument */
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (callback), (gpointer) "button 1");
|
||||
|
||||
/* instead of gtk_container_add, we pack this button into the invisible
|
||||
* box, which has been packed into the window. */
|
||||
gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);
|
||||
|
||||
/* always remember this step, this tells GTK that our preparation for
|
||||
* this button is complete, and it can be displayed now. */
|
||||
gtk_widget_show(button);
|
||||
|
||||
/* do these same steps again to create a second button */
|
||||
button = gtk_button_new_with_label ("Button 2");
|
||||
|
||||
/* call the same callback function with a different argument,
|
||||
* passing a pointer to "button 2" instead. */
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (callback), (gpointer) "button 2");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);
|
||||
|
||||
/* The order in which we show the buttons is not really important, but I
|
||||
* recommend showing the window last, so it all pops up at once. */
|
||||
gtk_widget_show(button);
|
||||
|
||||
gtk_widget_show(box1);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
/* rest in gtk_main and wait for the fun to begin! */
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
8
examples/list/Makefile
Normal file
8
examples/list/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
list: list.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` list.c -o list
|
||||
|
||||
clean:
|
||||
rm -f *.o list
|
||||
284
examples/list/list.c
Normal file
284
examples/list/list.c
Normal file
@@ -0,0 +1,284 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* list.c */
|
||||
|
||||
/* include the gtk+ header files
|
||||
* include stdio.h, we need that for the printf() function
|
||||
*/
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* this is our data identification string to store
|
||||
* data in list items
|
||||
*/
|
||||
const gchar *list_item_data_key="list_item_data";
|
||||
|
||||
|
||||
/* prototypes for signal handler that we are going to connect
|
||||
* to the GtkList widget
|
||||
*/
|
||||
static void sigh_print_selection (GtkWidget *gtklist,
|
||||
gpointer func_data);
|
||||
static void sigh_button_event (GtkWidget *gtklist,
|
||||
GdkEventButton *event,
|
||||
GtkWidget *frame);
|
||||
|
||||
|
||||
/* main function to set up the user interface */
|
||||
|
||||
gint main (int argc, gchar *argv[])
|
||||
{
|
||||
GtkWidget *separator;
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *gtklist;
|
||||
GtkWidget *button;
|
||||
GtkWidget *list_item;
|
||||
GList *dlist;
|
||||
guint i;
|
||||
gchar buffer[64];
|
||||
|
||||
|
||||
/* initialize gtk+ (and subsequently gdk) */
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
|
||||
/* create a window to put all the widgets in
|
||||
* connect gtk_main_quit() to the "destroy" event of
|
||||
* the window to handle window manager close-window-events
|
||||
*/
|
||||
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(window), "GtkList Example");
|
||||
gtk_signal_connect(GTK_OBJECT(window),
|
||||
"destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_main_quit),
|
||||
NULL);
|
||||
|
||||
|
||||
/* inside the window we need a box to arrange the widgets
|
||||
* vertically */
|
||||
vbox=gtk_vbox_new(FALSE, 5);
|
||||
gtk_container_border_width(GTK_CONTAINER(vbox), 5);
|
||||
gtk_container_add(GTK_CONTAINER(window), vbox);
|
||||
gtk_widget_show(vbox);
|
||||
|
||||
/* this is the scolled window to put the GtkList widget inside */
|
||||
scrolled_window=gtk_scrolled_window_new(NULL, NULL);
|
||||
gtk_widget_set_usize(scrolled_window, 250, 150);
|
||||
gtk_container_add(GTK_CONTAINER(vbox), scrolled_window);
|
||||
gtk_widget_show(scrolled_window);
|
||||
|
||||
/* create the GtkList widget
|
||||
* connect the sigh_print_selection() signal handler
|
||||
* function to the "selection_changed" signal of the GtkList
|
||||
* to print out the selected items each time the selection
|
||||
* has changed */
|
||||
gtklist=gtk_list_new();
|
||||
gtk_container_add(GTK_CONTAINER(scrolled_window), gtklist);
|
||||
gtk_widget_show(gtklist);
|
||||
gtk_signal_connect(GTK_OBJECT(gtklist),
|
||||
"selection_changed",
|
||||
GTK_SIGNAL_FUNC(sigh_print_selection),
|
||||
NULL);
|
||||
|
||||
/* we create a "Prison" to put a list item in ;)
|
||||
*/
|
||||
frame=gtk_frame_new("Prison");
|
||||
gtk_widget_set_usize(frame, 200, 50);
|
||||
gtk_container_border_width(GTK_CONTAINER(frame), 5);
|
||||
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT);
|
||||
gtk_container_add(GTK_CONTAINER(vbox), frame);
|
||||
gtk_widget_show(frame);
|
||||
|
||||
/* connect the sigh_button_event() signal handler to the GtkList
|
||||
* wich will handle the "arresting" of list items
|
||||
*/
|
||||
gtk_signal_connect(GTK_OBJECT(gtklist),
|
||||
"button_release_event",
|
||||
GTK_SIGNAL_FUNC(sigh_button_event),
|
||||
frame);
|
||||
|
||||
/* create a separator
|
||||
*/
|
||||
separator=gtk_hseparator_new();
|
||||
gtk_container_add(GTK_CONTAINER(vbox), separator);
|
||||
gtk_widget_show(separator);
|
||||
|
||||
/* finaly create a button and connect it´s "clicked" signal
|
||||
* to the destroyment of the window
|
||||
*/
|
||||
button=gtk_button_new_with_label("Close");
|
||||
gtk_container_add(GTK_CONTAINER(vbox), button);
|
||||
gtk_widget_show(button);
|
||||
gtk_signal_connect_object(GTK_OBJECT(button),
|
||||
"clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_widget_destroy),
|
||||
GTK_OBJECT(window));
|
||||
|
||||
|
||||
/* now we create 5 list items, each having it´s own
|
||||
* label and add them to the GtkList using gtk_container_add()
|
||||
* also we query the text string from the label and
|
||||
* associate it with the list_item_data_key for each list item
|
||||
*/
|
||||
for (i=0; i<5; i++) {
|
||||
GtkWidget *label;
|
||||
gchar *string;
|
||||
|
||||
sprintf(buffer, "ListItemContainer with Label #%d", i);
|
||||
label=gtk_label_new(buffer);
|
||||
list_item=gtk_list_item_new();
|
||||
gtk_container_add(GTK_CONTAINER(list_item), label);
|
||||
gtk_widget_show(label);
|
||||
gtk_container_add(GTK_CONTAINER(gtklist), list_item);
|
||||
gtk_widget_show(list_item);
|
||||
gtk_label_get(GTK_LABEL(label), &string);
|
||||
gtk_object_set_data(GTK_OBJECT(list_item),
|
||||
list_item_data_key,
|
||||
string);
|
||||
}
|
||||
/* here, we are creating another 5 labels, this time
|
||||
* we use gtk_list_item_new_with_label() for the creation
|
||||
* we can´t query the text string from the label because
|
||||
* we don´t have the labels pointer and therefore
|
||||
* we just associate the list_item_data_key of each
|
||||
* list item with the same text string
|
||||
* for adding of the list items we put them all into a doubly
|
||||
* linked list (GList), and then add them by a single call to
|
||||
* gtk_list_append_items()
|
||||
* because we use g_list_prepend() to put the items into the
|
||||
* doubly linked list, their order will be descending (instead
|
||||
* of ascending when using g_list_append())
|
||||
*/
|
||||
dlist=NULL;
|
||||
for (; i<10; i++) {
|
||||
sprintf(buffer, "List Item with Label %d", i);
|
||||
list_item=gtk_list_item_new_with_label(buffer);
|
||||
dlist=g_list_prepend(dlist, list_item);
|
||||
gtk_widget_show(list_item);
|
||||
gtk_object_set_data(GTK_OBJECT(list_item),
|
||||
list_item_data_key,
|
||||
"ListItem with integrated Label");
|
||||
}
|
||||
gtk_list_append_items(GTK_LIST(gtklist), dlist);
|
||||
|
||||
/* finaly we want to see the window, don´t we? ;)
|
||||
*/
|
||||
gtk_widget_show(window);
|
||||
|
||||
/* fire up the main event loop of gtk
|
||||
*/
|
||||
gtk_main();
|
||||
|
||||
/* we get here after gtk_main_quit() has been called which
|
||||
* happens if the main window gets destroyed
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* this is the signal handler that got connected to button
|
||||
* press/release events of the GtkList
|
||||
*/
|
||||
void
|
||||
sigh_button_event (GtkWidget *gtklist,
|
||||
GdkEventButton *event,
|
||||
GtkWidget *frame)
|
||||
{
|
||||
/* we only do something if the third (rightmost mouse button
|
||||
* was released
|
||||
*/
|
||||
if (event->type==GDK_BUTTON_RELEASE &&
|
||||
event->button==3) {
|
||||
GList *dlist, *free_list;
|
||||
GtkWidget *new_prisoner;
|
||||
|
||||
/* fetch the currently selected list item which
|
||||
* will be our next prisoner ;)
|
||||
*/
|
||||
dlist=GTK_LIST(gtklist)->selection;
|
||||
if (dlist)
|
||||
new_prisoner=GTK_WIDGET(dlist->data);
|
||||
else
|
||||
new_prisoner=NULL;
|
||||
|
||||
/* look for already prisoned list items, we
|
||||
* will put them back into the list
|
||||
* remember to free the doubly linked list that
|
||||
* gtk_container_children() returns
|
||||
*/
|
||||
dlist=gtk_container_children(GTK_CONTAINER(frame));
|
||||
free_list=dlist;
|
||||
while (dlist) {
|
||||
GtkWidget *list_item;
|
||||
|
||||
list_item=dlist->data;
|
||||
|
||||
gtk_widget_reparent(list_item, gtklist);
|
||||
|
||||
dlist=dlist->next;
|
||||
}
|
||||
g_list_free(free_list);
|
||||
|
||||
/* if we have a new prisoner, remove him from the
|
||||
* GtkList and put him into the frame "Prison"
|
||||
* we need to unselect the item before
|
||||
*/
|
||||
if (new_prisoner) {
|
||||
GList static_dlist;
|
||||
|
||||
static_dlist.data=new_prisoner;
|
||||
static_dlist.next=NULL;
|
||||
static_dlist.prev=NULL;
|
||||
|
||||
gtk_list_unselect_child(GTK_LIST(gtklist),
|
||||
new_prisoner);
|
||||
gtk_widget_reparent(new_prisoner, frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* this is the signal handler that gets called if GtkList
|
||||
* emits the "selection_changed" signal
|
||||
*/
|
||||
void
|
||||
sigh_print_selection (GtkWidget *gtklist,
|
||||
gpointer func_data)
|
||||
{
|
||||
GList *dlist;
|
||||
|
||||
/* fetch the doubly linked list of selected items
|
||||
* of the GtkList, remember to treat this as read-only!
|
||||
*/
|
||||
dlist=GTK_LIST(gtklist)->selection;
|
||||
|
||||
/* if there are no selected items there is nothing more
|
||||
* to do than just telling the user so
|
||||
*/
|
||||
if (!dlist) {
|
||||
g_print("Selection cleared\n");
|
||||
return;
|
||||
}
|
||||
/* ok, we got a selection and so we print it
|
||||
*/
|
||||
g_print("The selection is a ");
|
||||
|
||||
/* get the list item from the doubly linked list
|
||||
* and then query the data associated with list_item_data_key
|
||||
* we then just print it
|
||||
*/
|
||||
while (dlist) {
|
||||
GtkObject *list_item;
|
||||
gchar *item_data_string;
|
||||
|
||||
list_item=GTK_OBJECT(dlist->data);
|
||||
item_data_string=gtk_object_get_data(list_item,
|
||||
list_item_data_key);
|
||||
g_print("%s ", item_data_string);
|
||||
|
||||
dlist=dlist->next;
|
||||
}
|
||||
g_print("\n");
|
||||
}
|
||||
19
examples/menu/Makefile
Normal file
19
examples/menu/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
all: menu menufactory
|
||||
|
||||
menu: menu.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` menu.c -o menu
|
||||
|
||||
menufactory: menufactory.o mfmain.o
|
||||
$(CC) `gtk-config --libs` menufactory.o mfmain.o -o menufactory
|
||||
|
||||
menufactory.o: menufactory.c mfmain.h
|
||||
$(CC) `gtk-config --cflags` -c menufactory.c -o menufactory.o
|
||||
|
||||
mfmain.o: mfmain.c mfmain.h menufactory.h
|
||||
$(CC) `gtk-config --cflags` -c mfmain.c -o mfmain.o
|
||||
|
||||
clean:
|
||||
rm -f *.o menu menufactory
|
||||
134
examples/menu/menu.c
Normal file
134
examples/menu/menu.c
Normal file
@@ -0,0 +1,134 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* menu.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static gint button_press (GtkWidget *, GdkEvent *);
|
||||
static void menuitem_response (gchar *);
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
|
||||
GtkWidget *window;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menu_bar;
|
||||
GtkWidget *root_menu;
|
||||
GtkWidget *menu_items;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *button;
|
||||
char buf[128];
|
||||
int i;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* create a new window */
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_usize( GTK_WIDGET (window), 200, 100);
|
||||
gtk_window_set_title(GTK_WINDOW (window), "GTK Menu Test");
|
||||
gtk_signal_connect(GTK_OBJECT (window), "delete_event",
|
||||
(GtkSignalFunc) gtk_exit, NULL);
|
||||
|
||||
/* Init the menu-widget, and remember -- never
|
||||
* gtk_show_widget() the menu widget!!
|
||||
* This is the menu that holds the menu items, the one that
|
||||
* will pop up when you click on the "Root Menu" in the app */
|
||||
menu = gtk_menu_new();
|
||||
|
||||
/* Next we make a little loop that makes three menu-entries for "test-menu".
|
||||
* Notice the call to gtk_menu_append. Here we are adding a list of
|
||||
* menu items to our menu. Normally, we'd also catch the "clicked"
|
||||
* signal on each of the menu items and setup a callback for it,
|
||||
* but it's omitted here to save space. */
|
||||
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
/* Copy the names to the buf. */
|
||||
sprintf(buf, "Test-undermenu - %d", i);
|
||||
|
||||
/* Create a new menu-item with a name... */
|
||||
menu_items = gtk_menu_item_new_with_label(buf);
|
||||
|
||||
/* ...and add it to the menu. */
|
||||
gtk_menu_append(GTK_MENU (menu), menu_items);
|
||||
|
||||
/* Do something interesting when the menuitem is selected */
|
||||
gtk_signal_connect_object(GTK_OBJECT(menu_items), "activate",
|
||||
GTK_SIGNAL_FUNC(menuitem_response), (gpointer) g_strdup(buf));
|
||||
|
||||
/* Show the widget */
|
||||
gtk_widget_show(menu_items);
|
||||
}
|
||||
|
||||
/* This is the root menu, and will be the label
|
||||
* displayed on the menu bar. There won't be a signal handler attached,
|
||||
* as it only pops up the rest of the menu when pressed. */
|
||||
root_menu = gtk_menu_item_new_with_label("Root Menu");
|
||||
|
||||
gtk_widget_show(root_menu);
|
||||
|
||||
/* Now we specify that we want our newly created "menu" to be the menu
|
||||
* for the "root menu" */
|
||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM (root_menu), menu);
|
||||
|
||||
/* A vbox to put a menu and a button in: */
|
||||
vbox = gtk_vbox_new(FALSE, 0);
|
||||
gtk_container_add(GTK_CONTAINER(window), vbox);
|
||||
gtk_widget_show(vbox);
|
||||
|
||||
/* Create a menu-bar to hold the menus and add it to our main window */
|
||||
menu_bar = gtk_menu_bar_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, FALSE, 2);
|
||||
gtk_widget_show(menu_bar);
|
||||
|
||||
/* Create a button to which to attach menu as a popup */
|
||||
button = gtk_button_new_with_label("press me");
|
||||
gtk_signal_connect_object(GTK_OBJECT(button), "event",
|
||||
GTK_SIGNAL_FUNC (button_press), GTK_OBJECT(menu));
|
||||
gtk_box_pack_end(GTK_BOX(vbox), button, TRUE, TRUE, 2);
|
||||
gtk_widget_show(button);
|
||||
|
||||
/* And finally we append the menu-item to the menu-bar -- this is the
|
||||
* "root" menu-item I have been raving about =) */
|
||||
gtk_menu_bar_append(GTK_MENU_BAR (menu_bar), root_menu);
|
||||
|
||||
/* always display the window as the last step so it all splashes on
|
||||
* the screen at once. */
|
||||
gtk_widget_show(window);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Respond to a button-press by posting a menu passed in as widget.
|
||||
*
|
||||
* Note that the "widget" argument is the menu being posted, NOT
|
||||
* the button that was pressed.
|
||||
*/
|
||||
|
||||
static gint button_press (GtkWidget *widget, GdkEvent *event)
|
||||
{
|
||||
|
||||
if (event->type == GDK_BUTTON_PRESS) {
|
||||
GdkEventButton *bevent = (GdkEventButton *) event;
|
||||
gtk_menu_popup (GTK_MENU(widget), NULL, NULL, NULL, NULL,
|
||||
bevent->button, bevent->time);
|
||||
/* Tell calling code that we have handled this event; the buck
|
||||
* stops here. */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Tell calling code that we have not handled this event; pass it on. */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Print a string when a menu item is selected */
|
||||
|
||||
static void menuitem_response (gchar *string)
|
||||
{
|
||||
printf("%s\n", string);
|
||||
}
|
||||
151
examples/menu/menufactory.c
Normal file
151
examples/menu/menufactory.c
Normal file
@@ -0,0 +1,151 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* menufactory.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include "mfmain.h"
|
||||
|
||||
|
||||
static void menus_remove_accel(GtkWidget * widget, gchar * signal_name, gchar * path);
|
||||
static gint menus_install_accel(GtkWidget * widget, gchar * signal_name, gchar key, gchar modifiers, gchar * path);
|
||||
void menus_init(void);
|
||||
void menus_create(GtkMenuEntry * entries, int nmenu_entries);
|
||||
|
||||
|
||||
/* this is the GtkMenuEntry structure used to create new menus. The
|
||||
* first member is the menu definition string. The second, the
|
||||
* default accelerator key used to access this menu function with
|
||||
* the keyboard. The third is the callback function to call when
|
||||
* this menu item is selected (by the accelerator key, or with the
|
||||
* mouse.) The last member is the data to pass to your callback function.
|
||||
*/
|
||||
|
||||
static GtkMenuEntry menu_items[] =
|
||||
{
|
||||
{"<Main>/File/New", "<control>N", NULL, NULL},
|
||||
{"<Main>/File/Open", "<control>O", NULL, NULL},
|
||||
{"<Main>/File/Save", "<control>S", NULL, NULL},
|
||||
{"<Main>/File/Save as", NULL, NULL, NULL},
|
||||
{"<Main>/File/<separator>", NULL, NULL, NULL},
|
||||
{"<Main>/File/Quit", "<control>Q", file_quit_cmd_callback, "OK, I'll quit"},
|
||||
{"<Main>/Options/Test", NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
/* calculate the number of menu_item's */
|
||||
static int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
|
||||
|
||||
static int initialize = TRUE;
|
||||
static GtkMenuFactory *factory = NULL;
|
||||
static GtkMenuFactory *subfactory[1];
|
||||
static GHashTable *entry_ht = NULL;
|
||||
|
||||
void get_main_menu(GtkWidget ** menubar, GtkAcceleratorTable ** table)
|
||||
{
|
||||
if (initialize)
|
||||
menus_init();
|
||||
|
||||
if (menubar)
|
||||
*menubar = subfactory[0]->widget;
|
||||
if (table)
|
||||
*table = subfactory[0]->table;
|
||||
}
|
||||
|
||||
void menus_init(void)
|
||||
{
|
||||
if (initialize) {
|
||||
initialize = FALSE;
|
||||
|
||||
factory = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR);
|
||||
subfactory[0] = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR);
|
||||
|
||||
gtk_menu_factory_add_subfactory(factory, subfactory[0], "<Main>");
|
||||
menus_create(menu_items, nmenu_items);
|
||||
}
|
||||
}
|
||||
|
||||
void menus_create(GtkMenuEntry * entries, int nmenu_entries)
|
||||
{
|
||||
char *accelerator;
|
||||
int i;
|
||||
|
||||
if (initialize)
|
||||
menus_init();
|
||||
|
||||
if (entry_ht)
|
||||
for (i = 0; i < nmenu_entries; i++) {
|
||||
accelerator = g_hash_table_lookup(entry_ht, entries[i].path);
|
||||
if (accelerator) {
|
||||
if (accelerator[0] == '\0')
|
||||
entries[i].accelerator = NULL;
|
||||
else
|
||||
entries[i].accelerator = accelerator;
|
||||
}
|
||||
}
|
||||
gtk_menu_factory_add_entries(factory, entries, nmenu_entries);
|
||||
|
||||
for (i = 0; i < nmenu_entries; i++)
|
||||
if (entries[i].widget) {
|
||||
gtk_signal_connect(GTK_OBJECT(entries[i].widget), "install_accelerator",
|
||||
(GtkSignalFunc) menus_install_accel,
|
||||
entries[i].path);
|
||||
gtk_signal_connect(GTK_OBJECT(entries[i].widget), "remove_accelerator",
|
||||
(GtkSignalFunc) menus_remove_accel,
|
||||
entries[i].path);
|
||||
}
|
||||
}
|
||||
|
||||
static gint menus_install_accel(GtkWidget * widget, gchar * signal_name, gchar key, gchar modifiers, gchar * path)
|
||||
{
|
||||
char accel[64];
|
||||
char *t1, t2[2];
|
||||
|
||||
accel[0] = '\0';
|
||||
if (modifiers & GDK_CONTROL_MASK)
|
||||
strcat(accel, "<control>");
|
||||
if (modifiers & GDK_SHIFT_MASK)
|
||||
strcat(accel, "<shift>");
|
||||
if (modifiers & GDK_MOD1_MASK)
|
||||
strcat(accel, "<alt>");
|
||||
|
||||
t2[0] = key;
|
||||
t2[1] = '\0';
|
||||
strcat(accel, t2);
|
||||
|
||||
if (entry_ht) {
|
||||
t1 = g_hash_table_lookup(entry_ht, path);
|
||||
g_free(t1);
|
||||
} else
|
||||
entry_ht = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
|
||||
g_hash_table_insert(entry_ht, path, g_strdup(accel));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void menus_remove_accel(GtkWidget * widget, gchar * signal_name, gchar * path)
|
||||
{
|
||||
char *t;
|
||||
|
||||
if (entry_ht) {
|
||||
t = g_hash_table_lookup(entry_ht, path);
|
||||
g_free(t);
|
||||
|
||||
g_hash_table_insert(entry_ht, path, g_strdup(""));
|
||||
}
|
||||
}
|
||||
|
||||
void menus_set_sensitive(char *path, int sensitive)
|
||||
{
|
||||
GtkMenuPath *menu_path;
|
||||
|
||||
if (initialize)
|
||||
menus_init();
|
||||
|
||||
menu_path = gtk_menu_factory_find(factory, path);
|
||||
if (menu_path)
|
||||
gtk_widget_set_sensitive(menu_path->widget, sensitive);
|
||||
else
|
||||
g_warning("Unable to set sensitivity for menu which doesn't exist: %s", path);
|
||||
}
|
||||
19
examples/menu/menufactory.h
Normal file
19
examples/menu/menufactory.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* menufactory.h */
|
||||
|
||||
#ifndef __MENUFACTORY_H__
|
||||
#define __MENUFACTORY_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void get_main_menu (GtkWidget **menubar, GtkAcceleratorTable **table);
|
||||
void menus_create(GtkMenuEntry *entries, int nmenu_entries);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MENUFACTORY_H__ */
|
||||
52
examples/menu/mfmain.c
Normal file
52
examples/menu/mfmain.c
Normal file
@@ -0,0 +1,52 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* mfmain.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "mfmain.h"
|
||||
#include "menufactory.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *menubar;
|
||||
|
||||
GtkAcceleratorTable *accel;
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_signal_connect(GTK_OBJECT(window), "destroy",
|
||||
GTK_SIGNAL_FUNC(file_quit_cmd_callback),
|
||||
"WM destroy");
|
||||
gtk_window_set_title(GTK_WINDOW(window), "Menu Factory");
|
||||
gtk_widget_set_usize(GTK_WIDGET(window), 300, 200);
|
||||
|
||||
main_vbox = gtk_vbox_new(FALSE, 1);
|
||||
gtk_container_border_width(GTK_CONTAINER(main_vbox), 1);
|
||||
gtk_container_add(GTK_CONTAINER(window), main_vbox);
|
||||
gtk_widget_show(main_vbox);
|
||||
|
||||
get_main_menu(&menubar, &accel);
|
||||
gtk_window_add_accelerator_table(GTK_WINDOW(window), accel);
|
||||
gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, TRUE, 0);
|
||||
gtk_widget_show(menubar);
|
||||
|
||||
gtk_widget_show(window);
|
||||
gtk_main();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* This is just to demonstrate how callbacks work when using the
|
||||
* menufactory. Often, people put all the callbacks from the menus
|
||||
* in a separate file, and then have them call the appropriate functions
|
||||
* from there. Keeps it more organized. */
|
||||
void file_quit_cmd_callback (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
g_print ("%s\n", (char *) data);
|
||||
gtk_exit(0);
|
||||
}
|
||||
19
examples/menu/mfmain.h
Normal file
19
examples/menu/mfmain.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* mfmain.h */
|
||||
|
||||
#ifndef __MFMAIN_H__
|
||||
#define __MFMAIN_H__
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void file_quit_cmd_callback(GtkWidget *widget, gpointer data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MFMAIN_H__ */
|
||||
8
examples/notebook/Makefile
Normal file
8
examples/notebook/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
notebook: notebook.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` notebook.c -o notebook
|
||||
|
||||
clean:
|
||||
rm -f *.o notebook
|
||||
174
examples/notebook/notebook.c
Normal file
174
examples/notebook/notebook.c
Normal file
@@ -0,0 +1,174 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* notebook.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* This function rotates the position of the tabs */
|
||||
void rotate_book (GtkButton *button, GtkNotebook *notebook)
|
||||
{
|
||||
gtk_notebook_set_tab_pos (notebook, (notebook->tab_pos +1) %4);
|
||||
}
|
||||
|
||||
/* Add/Remove the page tabs and the borders */
|
||||
void tabsborder_book (GtkButton *button, GtkNotebook *notebook)
|
||||
{
|
||||
gint tval = FALSE;
|
||||
gint bval = FALSE;
|
||||
if (notebook->show_tabs == 0)
|
||||
tval = TRUE;
|
||||
if (notebook->show_border == 0)
|
||||
bval = TRUE;
|
||||
|
||||
gtk_notebook_set_show_tabs (notebook, tval);
|
||||
gtk_notebook_set_show_border (notebook, bval);
|
||||
}
|
||||
|
||||
/* Remove a page from the notebook */
|
||||
void remove_book (GtkButton *button, GtkNotebook *notebook)
|
||||
{
|
||||
gint page;
|
||||
|
||||
page = gtk_notebook_current_page(notebook);
|
||||
gtk_notebook_remove_page (notebook, page);
|
||||
/* Need to refresh the widget --
|
||||
This forces the widget to redraw itself. */
|
||||
gtk_widget_draw(GTK_WIDGET(notebook), NULL);
|
||||
}
|
||||
|
||||
void delete (GtkWidget *widget, GdkEvent *event, gpointer *data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *button;
|
||||
GtkWidget *table;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *label;
|
||||
GtkWidget *checkbutton;
|
||||
int i;
|
||||
char bufferf[32];
|
||||
char bufferl[32];
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (delete), NULL);
|
||||
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
table = gtk_table_new(2,6,TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (window), table);
|
||||
|
||||
/* Create a new notebook, place the position of the tabs */
|
||||
notebook = gtk_notebook_new ();
|
||||
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), notebook, 0,6,0,1);
|
||||
gtk_widget_show(notebook);
|
||||
|
||||
/* lets append a bunch of pages to the notebook */
|
||||
for (i=0; i < 5; i++) {
|
||||
sprintf(bufferf, "Append Frame %d", i+1);
|
||||
sprintf(bufferl, "Page %d", i+1);
|
||||
|
||||
frame = gtk_frame_new (bufferf);
|
||||
gtk_container_border_width (GTK_CONTAINER (frame), 10);
|
||||
gtk_widget_set_usize (frame, 100, 75);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
label = gtk_label_new (bufferf);
|
||||
gtk_container_add (GTK_CONTAINER (frame), label);
|
||||
gtk_widget_show (label);
|
||||
|
||||
label = gtk_label_new (bufferl);
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), frame, label);
|
||||
}
|
||||
|
||||
|
||||
/* now lets add a page to a specific spot */
|
||||
checkbutton = gtk_check_button_new_with_label ("Check me please!");
|
||||
gtk_widget_set_usize(checkbutton, 100, 75);
|
||||
gtk_widget_show (checkbutton);
|
||||
|
||||
label = gtk_label_new ("Add spot");
|
||||
gtk_container_add (GTK_CONTAINER (checkbutton), label);
|
||||
gtk_widget_show (label);
|
||||
label = gtk_label_new ("Add page");
|
||||
gtk_notebook_insert_page (GTK_NOTEBOOK (notebook), checkbutton, label, 2);
|
||||
|
||||
/* Now finally lets prepend pages to the notebook */
|
||||
for (i=0; i < 5; i++) {
|
||||
sprintf(bufferf, "Prepend Frame %d", i+1);
|
||||
sprintf(bufferl, "PPage %d", i+1);
|
||||
|
||||
frame = gtk_frame_new (bufferf);
|
||||
gtk_container_border_width (GTK_CONTAINER (frame), 10);
|
||||
gtk_widget_set_usize (frame, 100, 75);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
label = gtk_label_new (bufferf);
|
||||
gtk_container_add (GTK_CONTAINER (frame), label);
|
||||
gtk_widget_show (label);
|
||||
|
||||
label = gtk_label_new (bufferl);
|
||||
gtk_notebook_prepend_page (GTK_NOTEBOOK(notebook), frame, label);
|
||||
}
|
||||
|
||||
/* Set what page to start at (page 4) */
|
||||
gtk_notebook_set_page (GTK_NOTEBOOK(notebook), 3);
|
||||
|
||||
|
||||
/* create a bunch of buttons */
|
||||
button = gtk_button_new_with_label ("close");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (delete), NULL);
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 0,1,1,2);
|
||||
gtk_widget_show(button);
|
||||
|
||||
button = gtk_button_new_with_label ("next page");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) gtk_notebook_next_page,
|
||||
GTK_OBJECT (notebook));
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 1,2,1,2);
|
||||
gtk_widget_show(button);
|
||||
|
||||
button = gtk_button_new_with_label ("prev page");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) gtk_notebook_prev_page,
|
||||
GTK_OBJECT (notebook));
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 2,3,1,2);
|
||||
gtk_widget_show(button);
|
||||
|
||||
button = gtk_button_new_with_label ("tab position");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) rotate_book, GTK_OBJECT(notebook));
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 3,4,1,2);
|
||||
gtk_widget_show(button);
|
||||
|
||||
button = gtk_button_new_with_label ("tabs/border on/off");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) tabsborder_book,
|
||||
GTK_OBJECT (notebook));
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 4,5,1,2);
|
||||
gtk_widget_show(button);
|
||||
|
||||
button = gtk_button_new_with_label ("remove page");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) remove_book,
|
||||
GTK_OBJECT(notebook));
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 5,6,1,2);
|
||||
gtk_widget_show(button);
|
||||
|
||||
gtk_widget_show(table);
|
||||
gtk_widget_show(window);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
8
examples/packbox/Makefile
Normal file
8
examples/packbox/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
packbox: packbox.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` packbox.c -o packbox
|
||||
|
||||
clean:
|
||||
rm -f *.o packbox
|
||||
285
examples/packbox/packbox.c
Normal file
285
examples/packbox/packbox.c
Normal file
@@ -0,0 +1,285 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* packbox.c */
|
||||
|
||||
#include "gtk/gtk.h"
|
||||
|
||||
void
|
||||
delete_event (GtkWidget *widget, GdkEvent *event, gpointer *data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
/* Make a new hbox filled with button-labels. Arguments for the
|
||||
* variables we're interested are passed in to this function.
|
||||
* We do not show the box, but do show everything inside. */
|
||||
GtkWidget *make_box (gint homogeneous, gint spacing,
|
||||
gint expand, gint fill, gint padding)
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkWidget *button;
|
||||
char padstr[80];
|
||||
|
||||
/* create a new hbox with the appropriate homogeneous and spacing
|
||||
* settings */
|
||||
box = gtk_hbox_new (homogeneous, spacing);
|
||||
|
||||
/* create a series of buttons with the appropriate settings */
|
||||
button = gtk_button_new_with_label ("gtk_box_pack");
|
||||
gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("(box,");
|
||||
gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("button,");
|
||||
gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* create a button with the label depending on the value of
|
||||
* expand. */
|
||||
if (expand == TRUE)
|
||||
button = gtk_button_new_with_label ("TRUE,");
|
||||
else
|
||||
button = gtk_button_new_with_label ("FALSE,");
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* This is the same as the button creation for "expand"
|
||||
* above, but uses the shorthand form. */
|
||||
button = gtk_button_new_with_label (fill ? "TRUE," : "FALSE,");
|
||||
gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
|
||||
gtk_widget_show (button);
|
||||
|
||||
sprintf (padstr, "%d);", padding);
|
||||
|
||||
button = gtk_button_new_with_label (padstr);
|
||||
gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
|
||||
gtk_widget_show (button);
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *button;
|
||||
GtkWidget *box1;
|
||||
GtkWidget *box2;
|
||||
GtkWidget *separator;
|
||||
GtkWidget *label;
|
||||
GtkWidget *quitbox;
|
||||
int which;
|
||||
|
||||
/* Our init, don't forget this! :) */
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf (stderr, "usage: packbox num, where num is 1, 2, or 3.\n");
|
||||
/* this just does cleanup in GTK, and exits with an exit status of 1. */
|
||||
gtk_exit (1);
|
||||
}
|
||||
|
||||
which = atoi (argv[1]);
|
||||
|
||||
/* Create our window */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
/* You should always remember to connect the destroy signal to the
|
||||
* main window. This is very important for proper intuitive
|
||||
* behavior */
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (delete_event), NULL);
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
/* We create a vertical box (vbox) to pack the horizontal boxes into.
|
||||
* This allows us to stack the horizontal boxes filled with buttons one
|
||||
* on top of the other in this vbox. */
|
||||
box1 = gtk_vbox_new (FALSE, 0);
|
||||
|
||||
/* which example to show. These correspond to the pictures above. */
|
||||
switch (which) {
|
||||
case 1:
|
||||
/* create a new label. */
|
||||
label = gtk_label_new ("gtk_hbox_new (FALSE, 0);");
|
||||
|
||||
/* Align the label to the left side. We'll discuss this function and
|
||||
* others in the section on Widget Attributes. */
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
|
||||
|
||||
/* Pack the label into the vertical box (vbox box1). Remember that
|
||||
* widgets added to a vbox will be packed one on top of the other in
|
||||
* order. */
|
||||
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
|
||||
|
||||
/* show the label */
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* call our make box function - homogeneous = FALSE, spacing = 0,
|
||||
* expand = FALSE, fill = FALSE, padding = 0 */
|
||||
box2 = make_box (FALSE, 0, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* call our make box function - homogeneous = FALSE, spacing = 0,
|
||||
* expand = FALSE, fill = FALSE, padding = 0 */
|
||||
box2 = make_box (FALSE, 0, TRUE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* Args are: homogeneous, spacing, expand, fill, padding */
|
||||
box2 = make_box (FALSE, 0, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* creates a separator, we'll learn more about these later,
|
||||
* but they are quite simple. */
|
||||
separator = gtk_hseparator_new ();
|
||||
|
||||
/* pack the separator into the vbox. Remember each of these
|
||||
* widgets are being packed into a vbox, so they'll be stacked
|
||||
* vertically. */
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
|
||||
gtk_widget_show (separator);
|
||||
|
||||
/* create another new label, and show it. */
|
||||
label = gtk_label_new ("gtk_hbox_new (TRUE, 0);");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Args are: homogeneous, spacing, expand, fill, padding */
|
||||
box2 = make_box (TRUE, 0, TRUE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* Args are: homogeneous, spacing, expand, fill, padding */
|
||||
box2 = make_box (TRUE, 0, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* another new separator. */
|
||||
separator = gtk_hseparator_new ();
|
||||
/* The last 3 arguments to gtk_box_pack_start are: expand, fill, padding. */
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
|
||||
gtk_widget_show (separator);
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
/* create a new label, remember box1 is a vbox as created
|
||||
* near the beginning of main() */
|
||||
label = gtk_label_new ("gtk_hbox_new (FALSE, 10);");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Args are: homogeneous, spacing, expand, fill, padding */
|
||||
box2 = make_box (FALSE, 10, TRUE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* Args are: homogeneous, spacing, expand, fill, padding */
|
||||
box2 = make_box (FALSE, 10, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
separator = gtk_hseparator_new ();
|
||||
/* The last 3 arguments to gtk_box_pack_start are: expand, fill, padding. */
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
|
||||
gtk_widget_show (separator);
|
||||
|
||||
label = gtk_label_new ("gtk_hbox_new (FALSE, 0);");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Args are: homogeneous, spacing, expand, fill, padding */
|
||||
box2 = make_box (FALSE, 0, TRUE, FALSE, 10);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* Args are: homogeneous, spacing, expand, fill, padding */
|
||||
box2 = make_box (FALSE, 0, TRUE, TRUE, 10);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
separator = gtk_hseparator_new ();
|
||||
/* The last 3 arguments to gtk_box_pack_start are: expand, fill, padding. */
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
|
||||
gtk_widget_show (separator);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
/* This demonstrates the ability to use gtk_box_pack_end() to
|
||||
* right justify widgets. First, we create a new box as before. */
|
||||
box2 = make_box (FALSE, 0, FALSE, FALSE, 0);
|
||||
/* create the label that will be put at the end. */
|
||||
label = gtk_label_new ("end");
|
||||
/* pack it using gtk_box_pack_end(), so it is put on the right side
|
||||
* of the hbox created in the make_box() call. */
|
||||
gtk_box_pack_end (GTK_BOX (box2), label, FALSE, FALSE, 0);
|
||||
/* show the label. */
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* pack box2 into box1 (the vbox remember ? :) */
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* a separator for the bottom. */
|
||||
separator = gtk_hseparator_new ();
|
||||
/* this explicitly sets the separator to 400 pixels wide by 5 pixels
|
||||
* high. This is so the hbox we created will also be 400 pixels wide,
|
||||
* and the "end" label will be separated from the other labels in the
|
||||
* hbox. Otherwise, all the widgets in the hbox would be packed as
|
||||
* close together as possible. */
|
||||
gtk_widget_set_usize (separator, 400, 5);
|
||||
/* pack the separator into the vbox (box1) created near the start
|
||||
* of main() */
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
|
||||
gtk_widget_show (separator);
|
||||
}
|
||||
|
||||
/* Create another new hbox.. remember we can use as many as we need! */
|
||||
quitbox = gtk_hbox_new (FALSE, 0);
|
||||
|
||||
/* Our quit button. */
|
||||
button = gtk_button_new_with_label ("Quit");
|
||||
|
||||
/* setup the signal to destroy the window. Remember that this will send
|
||||
* the "destroy" signal to the window which will be caught by our signal
|
||||
* handler as defined above. */
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
GTK_OBJECT (window));
|
||||
/* pack the button into the quitbox.
|
||||
* The last 3 arguments to gtk_box_pack_start are: expand, fill, padding. */
|
||||
gtk_box_pack_start (GTK_BOX (quitbox), button, TRUE, FALSE, 0);
|
||||
/* pack the quitbox into the vbox (box1) */
|
||||
gtk_box_pack_start (GTK_BOX (box1), quitbox, FALSE, FALSE, 0);
|
||||
|
||||
/* pack the vbox (box1) which now contains all our widgets, into the
|
||||
* main window. */
|
||||
gtk_container_add (GTK_CONTAINER (window), box1);
|
||||
|
||||
/* and show everything left */
|
||||
gtk_widget_show (button);
|
||||
gtk_widget_show (quitbox);
|
||||
|
||||
gtk_widget_show (box1);
|
||||
/* Showing the window last so everything pops up at once. */
|
||||
gtk_widget_show (window);
|
||||
|
||||
/* And of course, our main function. */
|
||||
gtk_main ();
|
||||
|
||||
/* control returns here when gtk_main_quit() is called, but not when
|
||||
* gtk_exit is used. */
|
||||
|
||||
return 0;
|
||||
}
|
||||
8
examples/paned/Makefile
Normal file
8
examples/paned/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
paned: paned.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` paned.c -o paned
|
||||
|
||||
clean:
|
||||
rm -f *.o paned
|
||||
136
examples/paned/paned.c
Normal file
136
examples/paned/paned.c
Normal file
@@ -0,0 +1,136 @@
|
||||
/* paned.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Create the list of "messages" */
|
||||
GtkWidget *
|
||||
create_list (void)
|
||||
{
|
||||
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *list;
|
||||
GtkWidget *list_item;
|
||||
|
||||
int i;
|
||||
char buffer[16];
|
||||
|
||||
/* Create a new scrolled window, with scrollbars only if needed */
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
|
||||
/* Create a new list and put it in the scrolled window */
|
||||
list = gtk_list_new ();
|
||||
gtk_container_add (GTK_CONTAINER(scrolled_window), list);
|
||||
gtk_widget_show (list);
|
||||
|
||||
/* Add some messages to the window */
|
||||
for (i=0; i<10; i++) {
|
||||
|
||||
sprintf(buffer,"Message #%d",i);
|
||||
list_item = gtk_list_item_new_with_label (buffer);
|
||||
gtk_container_add (GTK_CONTAINER(list), list_item);
|
||||
gtk_widget_show (list_item);
|
||||
|
||||
}
|
||||
|
||||
return scrolled_window;
|
||||
}
|
||||
|
||||
/* Add some text to our text widget - this is a callback that is invoked
|
||||
when our window is realized. We could also force our window to be
|
||||
realized with gtk_widget_realize, but it would have to be part of
|
||||
a hierarchy first */
|
||||
|
||||
void
|
||||
realize_text (GtkWidget *text, gpointer data)
|
||||
{
|
||||
gtk_text_freeze (GTK_TEXT (text));
|
||||
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
|
||||
"From: pathfinder@nasa.gov\n"
|
||||
"To: mom@nasa.gov\n"
|
||||
"Subject: Made it!\n"
|
||||
"\n"
|
||||
"We just got in this morning. The weather has been\n"
|
||||
"great - clear but cold, and there are lots of fun sights.\n"
|
||||
"Sojourner says hi. See you soon.\n"
|
||||
" -Path\n", -1);
|
||||
|
||||
gtk_text_thaw (GTK_TEXT (text));
|
||||
}
|
||||
|
||||
/* Create a scrolled text area that displays a "message" */
|
||||
GtkWidget *
|
||||
create_text (void)
|
||||
{
|
||||
GtkWidget *table;
|
||||
GtkWidget *text;
|
||||
GtkWidget *hscrollbar;
|
||||
GtkWidget *vscrollbar;
|
||||
|
||||
/* Create a table to hold the text widget and scrollbars */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
|
||||
/* Put a text widget in the upper left hand corner. Note the use of
|
||||
* GTK_SHRINK in the y direction */
|
||||
text = gtk_text_new (NULL, NULL);
|
||||
gtk_table_attach (GTK_TABLE (table), text, 0, 1, 0, 1,
|
||||
GTK_FILL | GTK_EXPAND,
|
||||
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 0);
|
||||
gtk_widget_show (text);
|
||||
|
||||
/* Put a HScrollbar in the lower left hand corner */
|
||||
hscrollbar = gtk_hscrollbar_new (GTK_TEXT (text)->hadj);
|
||||
gtk_table_attach (GTK_TABLE (table), hscrollbar, 0, 1, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_widget_show (hscrollbar);
|
||||
|
||||
/* And a VScrollbar in the upper right */
|
||||
vscrollbar = gtk_vscrollbar_new (GTK_TEXT (text)->vadj);
|
||||
gtk_table_attach (GTK_TABLE (table), vscrollbar, 1, 2, 0, 1,
|
||||
GTK_FILL, GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0);
|
||||
gtk_widget_show (vscrollbar);
|
||||
|
||||
/* Add a handler to put a message in the text widget when it is realized */
|
||||
gtk_signal_connect (GTK_OBJECT (text), "realize",
|
||||
GTK_SIGNAL_FUNC (realize_text), NULL);
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *vpaned;
|
||||
GtkWidget *list;
|
||||
GtkWidget *text;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Paned Windows");
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
/* create a vpaned widget and add it to our toplevel window */
|
||||
|
||||
vpaned = gtk_vpaned_new ();
|
||||
gtk_container_add (GTK_CONTAINER(window), vpaned);
|
||||
gtk_widget_show (vpaned);
|
||||
|
||||
/* Now create the contents of the two halves of the window */
|
||||
|
||||
list = create_list ();
|
||||
gtk_paned_add1 (GTK_PANED(vpaned), list);
|
||||
gtk_widget_show (list);
|
||||
|
||||
text = create_text ();
|
||||
gtk_paned_add2 (GTK_PANED(vpaned), text);
|
||||
gtk_widget_show (text);
|
||||
gtk_widget_show (window);
|
||||
gtk_main ();
|
||||
return 0;
|
||||
}
|
||||
8
examples/pixmap/Makefile
Normal file
8
examples/pixmap/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
pixmap: pixmap.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` pixmap.c -o pixmap
|
||||
|
||||
clean:
|
||||
rm -f *.o pixmap
|
||||
85
examples/pixmap/pixmap.c
Normal file
85
examples/pixmap/pixmap.c
Normal file
@@ -0,0 +1,85 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* pixmap.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
/* XPM data of Open-File icon */
|
||||
static const char * xpm_data[] = {
|
||||
"16 16 3 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #FFFFFFFFFFFF",
|
||||
" ",
|
||||
" ...... ",
|
||||
" .XXX.X. ",
|
||||
" .XXX.XX. ",
|
||||
" .XXX.XXX. ",
|
||||
" .XXX..... ",
|
||||
" .XXXXXXX. ",
|
||||
" .XXXXXXX. ",
|
||||
" .XXXXXXX. ",
|
||||
" .XXXXXXX. ",
|
||||
" .XXXXXXX. ",
|
||||
" .XXXXXXX. ",
|
||||
" .XXXXXXX. ",
|
||||
" ......... ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
|
||||
/* when invoked (via signal delete_event), terminates the application.
|
||||
*/
|
||||
void close_application( GtkWidget *widget, GdkEvent *event, gpointer *data ) {
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
|
||||
/* is invoked when the button is clicked. It just prints a message.
|
||||
*/
|
||||
void button_clicked( GtkWidget *widget, gpointer *data ) {
|
||||
printf( "button clicked\n" );
|
||||
}
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
/* GtkWidget is the storage type for widgets */
|
||||
GtkWidget *window, *pixmapwid, *button;
|
||||
GdkPixmap *pixmap;
|
||||
GdkBitmap *mask;
|
||||
GtkStyle *style;
|
||||
|
||||
/* create the main window, and attach delete_event signal to terminating
|
||||
the application */
|
||||
gtk_init( &argc, &argv );
|
||||
window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
|
||||
gtk_signal_connect( GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (close_application), NULL );
|
||||
gtk_container_border_width( GTK_CONTAINER (window), 10 );
|
||||
gtk_widget_show( window );
|
||||
|
||||
/* now for the pixmap from gdk */
|
||||
style = gtk_widget_get_style( window );
|
||||
pixmap = gdk_pixmap_create_from_xpm_d( window->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
(gchar **)xpm_data );
|
||||
|
||||
/* a pixmap widget to contain the pixmap */
|
||||
pixmapwid = gtk_pixmap_new( pixmap, mask );
|
||||
gtk_widget_show( pixmapwid );
|
||||
|
||||
/* a button to contain the pixmap widget */
|
||||
button = gtk_button_new();
|
||||
gtk_container_add( GTK_CONTAINER(button), pixmapwid );
|
||||
gtk_container_add( GTK_CONTAINER(window), button );
|
||||
gtk_widget_show( button );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(button), "clicked",
|
||||
GTK_SIGNAL_FUNC(button_clicked), NULL );
|
||||
|
||||
/* show the window */
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
8
examples/progressbar/Makefile
Normal file
8
examples/progressbar/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
progressbar: progressbar.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` progressbar.c -o progressbar
|
||||
|
||||
clean:
|
||||
rm -f *.o progressbar
|
||||
93
examples/progressbar/progressbar.c
Normal file
93
examples/progressbar/progressbar.c
Normal file
@@ -0,0 +1,93 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* progressbar.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static int ptimer = 0;
|
||||
int pstat = TRUE;
|
||||
|
||||
/* This function increments and updates the progress bar, it also resets
|
||||
the progress bar if pstat is FALSE */
|
||||
gint progress (gpointer data)
|
||||
{
|
||||
gfloat pvalue;
|
||||
|
||||
/* get the current value of the progress bar */
|
||||
pvalue = GTK_PROGRESS_BAR (data)->percentage;
|
||||
|
||||
if ((pvalue >= 1.0) || (pstat == FALSE)) {
|
||||
pvalue = 0.0;
|
||||
pstat = TRUE;
|
||||
}
|
||||
pvalue += 0.01;
|
||||
|
||||
gtk_progress_bar_update (GTK_PROGRESS_BAR (data), pvalue);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* This function signals a reset of the progress bar */
|
||||
void progress_r (void)
|
||||
{
|
||||
pstat = FALSE;
|
||||
}
|
||||
|
||||
void destroy (GtkWidget *widget, GdkEvent *event, gpointer *data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *button;
|
||||
GtkWidget *label;
|
||||
GtkWidget *table;
|
||||
GtkWidget *pbar;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (destroy), NULL);
|
||||
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
table = gtk_table_new(3,2,TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (window), table);
|
||||
|
||||
label = gtk_label_new ("Progress Bar Example");
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), label, 0,2,0,1);
|
||||
gtk_widget_show(label);
|
||||
|
||||
/* Create a new progress bar, pack it into the table, and show it */
|
||||
pbar = gtk_progress_bar_new ();
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), pbar, 0,2,1,2);
|
||||
gtk_widget_show (pbar);
|
||||
|
||||
/* Set the timeout to handle automatic updating of the progress bar */
|
||||
ptimer = gtk_timeout_add (100, progress, pbar);
|
||||
|
||||
/* This button signals the progress bar to be reset */
|
||||
button = gtk_button_new_with_label ("Reset");
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (progress_r), NULL);
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 0,1,2,3);
|
||||
gtk_widget_show(button);
|
||||
|
||||
button = gtk_button_new_with_label ("Cancel");
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (destroy), NULL);
|
||||
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 1,2,2,3);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_show(table);
|
||||
gtk_widget_show(window);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
8
examples/radiobuttons/Makefile
Normal file
8
examples/radiobuttons/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
radiobuttons: radiobuttons.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` radiobuttons.c -o radiobuttons
|
||||
|
||||
clean:
|
||||
rm -f *.o radiobuttons
|
||||
76
examples/radiobuttons/radiobuttons.c
Normal file
76
examples/radiobuttons/radiobuttons.c
Normal file
@@ -0,0 +1,76 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* radiobuttons.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib.h>
|
||||
|
||||
void close_application( GtkWidget *widget, GdkEvent *event, gpointer *data ) {
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *box1;
|
||||
GtkWidget *box2;
|
||||
GtkWidget *button;
|
||||
GtkWidget *separator;
|
||||
GSList *group;
|
||||
|
||||
gtk_init(&argc,&argv);
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC(close_application),
|
||||
NULL);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "radio buttons");
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
box1 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), box1);
|
||||
gtk_widget_show (box1);
|
||||
|
||||
box2 = gtk_vbox_new (FALSE, 10);
|
||||
gtk_container_border_width (GTK_CONTAINER (box2), 10);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
button = gtk_radio_button_new_with_label (NULL, "button1");
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
button = gtk_radio_button_new_with_label(group, "button2");
|
||||
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
button = gtk_radio_button_new_with_label(group, "button3");
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
separator = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
|
||||
gtk_widget_show (separator);
|
||||
|
||||
box2 = gtk_vbox_new (FALSE, 10);
|
||||
gtk_container_border_width (GTK_CONTAINER (box2), 10);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
button = gtk_button_new_with_label ("close");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC(close_application),
|
||||
GTK_OBJECT (window));
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_main();
|
||||
return(0);
|
||||
}
|
||||
8
examples/rulers/Makefile
Normal file
8
examples/rulers/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
rulers: rulers.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` rulers.c -o rulers
|
||||
|
||||
clean:
|
||||
rm -f *.o rulers
|
||||
75
examples/rulers/rulers.c
Normal file
75
examples/rulers/rulers.c
Normal file
@@ -0,0 +1,75 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* rulers.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define EVENT_METHOD(i, x) GTK_WIDGET_CLASS(GTK_OBJECT(i)->klass)->x
|
||||
|
||||
#define XSIZE 600
|
||||
#define YSIZE 400
|
||||
|
||||
/* this routine gets control when the close button is clicked
|
||||
*/
|
||||
void close_application( GtkWidget *widget, GdkEvent *event, gpointer *data ) {
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
|
||||
/* the main routine
|
||||
*/
|
||||
int main( int argc, char *argv[] ) {
|
||||
GtkWidget *window, *table, *area, *hrule, *vrule;
|
||||
|
||||
/* initialize gtk and create the main window */
|
||||
gtk_init( &argc, &argv );
|
||||
|
||||
window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC( close_application ), NULL);
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
/* create a table for placing the ruler and the drawing area */
|
||||
table = gtk_table_new( 3, 2, FALSE );
|
||||
gtk_container_add( GTK_CONTAINER(window), table );
|
||||
|
||||
area = gtk_drawing_area_new();
|
||||
gtk_drawing_area_size( (GtkDrawingArea *)area, XSIZE, YSIZE );
|
||||
gtk_table_attach( GTK_TABLE(table), area, 1, 2, 1, 2,
|
||||
GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0 );
|
||||
gtk_widget_set_events( area, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK );
|
||||
|
||||
/* The horizontal ruler goes on top. As the mouse moves across the drawing area,
|
||||
a motion_notify_event is passed to the appropriate event handler for the ruler. */
|
||||
hrule = gtk_hruler_new();
|
||||
gtk_ruler_set_metric( GTK_RULER(hrule), GTK_PIXELS );
|
||||
gtk_ruler_set_range( GTK_RULER(hrule), 7, 13, 0, 20 );
|
||||
gtk_signal_connect_object( GTK_OBJECT(area), "motion_notify_event",
|
||||
(GtkSignalFunc)EVENT_METHOD(hrule, motion_notify_event),
|
||||
GTK_OBJECT(hrule) );
|
||||
/* GTK_WIDGET_CLASS(GTK_OBJECT(hrule)->klass)->motion_notify_event, */
|
||||
gtk_table_attach( GTK_TABLE(table), hrule, 1, 2, 0, 1,
|
||||
GTK_EXPAND|GTK_SHRINK|GTK_FILL, GTK_FILL, 0, 0 );
|
||||
|
||||
/* The vertical ruler goes on the left. As the mouse moves across the drawing area,
|
||||
a motion_notify_event is passed to the appropriate event handler for the ruler. */
|
||||
vrule = gtk_vruler_new();
|
||||
gtk_ruler_set_metric( GTK_RULER(vrule), GTK_PIXELS );
|
||||
gtk_ruler_set_range( GTK_RULER(vrule), 0, YSIZE, 10, YSIZE );
|
||||
gtk_signal_connect_object( GTK_OBJECT(area), "motion_notify_event",
|
||||
(GtkSignalFunc)
|
||||
GTK_WIDGET_CLASS(GTK_OBJECT(vrule)->klass)->motion_notify_event,
|
||||
GTK_OBJECT(vrule) );
|
||||
gtk_table_attach( GTK_TABLE(table), vrule, 0, 1, 1, 2,
|
||||
GTK_FILL, GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0 );
|
||||
|
||||
/* now show everything */
|
||||
gtk_widget_show( area );
|
||||
gtk_widget_show( hrule );
|
||||
gtk_widget_show( vrule );
|
||||
gtk_widget_show( table );
|
||||
gtk_widget_show( window );
|
||||
gtk_main();
|
||||
|
||||
return 0;
|
||||
}
|
||||
8
examples/scribble-simple/Makefile
Normal file
8
examples/scribble-simple/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
scribble-simple: scribble-simple.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` scribble-simple.c -o scribble-simple
|
||||
|
||||
clean:
|
||||
rm -f scribble-simple
|
||||
177
examples/scribble-simple/scribble-simple.c
Normal file
177
examples/scribble-simple/scribble-simple.c
Normal file
@@ -0,0 +1,177 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Backing pixmap for drawing area */
|
||||
static GdkPixmap *pixmap = NULL;
|
||||
|
||||
/* Create a new backing pixmap of the appropriate size */
|
||||
static gint
|
||||
configure_event (GtkWidget *widget, GdkEventConfigure *event)
|
||||
{
|
||||
if (pixmap)
|
||||
gdk_pixmap_unref(pixmap);
|
||||
|
||||
pixmap = gdk_pixmap_new(widget->window,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height,
|
||||
-1);
|
||||
gdk_draw_rectangle (pixmap,
|
||||
widget->style->white_gc,
|
||||
TRUE,
|
||||
0, 0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Redraw the screen from the backing pixmap */
|
||||
static gint
|
||||
expose_event (GtkWidget *widget, GdkEventExpose *event)
|
||||
{
|
||||
gdk_draw_pixmap(widget->window,
|
||||
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
|
||||
pixmap,
|
||||
event->area.x, event->area.y,
|
||||
event->area.x, event->area.y,
|
||||
event->area.width, event->area.height);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Draw a rectangle on the screen */
|
||||
static void
|
||||
draw_brush (GtkWidget *widget, gdouble x, gdouble y)
|
||||
{
|
||||
GdkRectangle update_rect;
|
||||
|
||||
update_rect.x = x - 5;
|
||||
update_rect.y = y - 5;
|
||||
update_rect.width = 10;
|
||||
update_rect.height = 10;
|
||||
gdk_draw_rectangle (pixmap,
|
||||
widget->style->black_gc,
|
||||
TRUE,
|
||||
update_rect.x, update_rect.y,
|
||||
update_rect.width, update_rect.height);
|
||||
gtk_widget_draw (widget, &update_rect);
|
||||
}
|
||||
|
||||
static gint
|
||||
button_press_event (GtkWidget *widget, GdkEventButton *event)
|
||||
{
|
||||
if (event->button == 1 && pixmap != NULL)
|
||||
draw_brush (widget, event->x, event->y);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gint
|
||||
motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
|
||||
{
|
||||
int x, y;
|
||||
GdkModifierType state;
|
||||
|
||||
if (event->is_hint)
|
||||
gdk_window_get_pointer (event->window, &x, &y, &state);
|
||||
else
|
||||
{
|
||||
x = event->x;
|
||||
y = event->y;
|
||||
state = event->state;
|
||||
}
|
||||
|
||||
if (state & GDK_BUTTON1_MASK && pixmap != NULL)
|
||||
draw_brush (widget, x, y);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
quit ()
|
||||
{
|
||||
gtk_exit (0);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *drawing_area;
|
||||
GtkWidget *vbox;
|
||||
|
||||
GtkWidget *button;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_name (window, "Test Input");
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (quit), NULL);
|
||||
|
||||
/* Create the drawing area */
|
||||
|
||||
drawing_area = gtk_drawing_area_new ();
|
||||
gtk_drawing_area_size (GTK_DRAWING_AREA (drawing_area), 200, 200);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show (drawing_area);
|
||||
|
||||
/* Signals used to handle backing pixmap */
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (drawing_area), "expose_event",
|
||||
(GtkSignalFunc) expose_event, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT(drawing_area),"configure_event",
|
||||
(GtkSignalFunc) configure_event, NULL);
|
||||
|
||||
/* Event signals */
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (drawing_area), "motion_notify_event",
|
||||
(GtkSignalFunc) motion_notify_event, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (drawing_area), "button_press_event",
|
||||
(GtkSignalFunc) button_press_event, NULL);
|
||||
|
||||
gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK
|
||||
| GDK_LEAVE_NOTIFY_MASK
|
||||
| GDK_BUTTON_PRESS_MASK
|
||||
| GDK_POINTER_MOTION_MASK
|
||||
| GDK_POINTER_MOTION_HINT_MASK);
|
||||
|
||||
/* .. And a quit button */
|
||||
button = gtk_button_new_with_label ("Quit");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
GTK_OBJECT (window));
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
8
examples/scrolledwin/Makefile
Normal file
8
examples/scrolledwin/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
scrolledwin: scrolledwin.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` scrolledwin.c -o scrolledwin
|
||||
|
||||
clean:
|
||||
rm -f *.o scrolledwin
|
||||
94
examples/scrolledwin/scrolledwin.c
Normal file
94
examples/scrolledwin/scrolledwin.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* scrolledwin.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
void destroy(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
static GtkWidget *window;
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *table;
|
||||
GtkWidget *button;
|
||||
char buffer[32];
|
||||
int i, j;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* Create a new dialog window for the scrolled window to be
|
||||
* packed into. A dialog is just like a normal window except it has a
|
||||
* vbox and a horizontal seperator packed into it. It's just a shortcut
|
||||
* for creating dialogs */
|
||||
window = gtk_dialog_new ();
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
(GtkSignalFunc) destroy, NULL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "dialog");
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 0);
|
||||
gtk_widget_set_usize(window, 300, 300);
|
||||
|
||||
/* create a new scrolled window. */
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
|
||||
gtk_container_border_width (GTK_CONTAINER (scrolled_window), 10);
|
||||
|
||||
/* the policy is one of GTK_POLICY AUTOMATIC, or GTK_POLICY_ALWAYS.
|
||||
* GTK_POLICY_AUTOMATIC will automatically decide whether you need
|
||||
* scrollbars, wheras GTK_POLICY_ALWAYS will always leave the scrollbars
|
||||
* there. The first one is the horizontal scrollbar, the second,
|
||||
* the vertical. */
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
|
||||
/* The dialog window is created with a vbox packed into it. */
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(window)->vbox), scrolled_window,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (scrolled_window);
|
||||
|
||||
/* create a table of 10 by 10 squares. */
|
||||
table = gtk_table_new (10, 10, FALSE);
|
||||
|
||||
/* set the spacing to 10 on x and 10 on y */
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 10);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 10);
|
||||
|
||||
/* pack the table into the scrolled window */
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), table);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* this simply creates a grid of toggle buttons on the table
|
||||
* to demonstrate the scrolled window. */
|
||||
for (i = 0; i < 10; i++)
|
||||
for (j = 0; j < 10; j++) {
|
||||
sprintf (buffer, "button (%d,%d)\n", i, j);
|
||||
button = gtk_toggle_button_new_with_label (buffer);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button,
|
||||
i, i+1, j, j+1);
|
||||
gtk_widget_show (button);
|
||||
}
|
||||
|
||||
/* Add a "close" button to the bottom of the dialog */
|
||||
button = gtk_button_new_with_label ("close");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) gtk_widget_destroy,
|
||||
GTK_OBJECT (window));
|
||||
|
||||
/* this makes it so the button is the default. */
|
||||
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area), button, TRUE, TRUE, 0);
|
||||
|
||||
/* This grabs this button to be the default button. Simply hitting
|
||||
* the "Enter" key will cause this button to activate. */
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_main();
|
||||
|
||||
return(0);
|
||||
}
|
||||
13
examples/selection/Makefile
Normal file
13
examples/selection/Makefile
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
all: gettargets setselection
|
||||
|
||||
gettargets: gettargets.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` gettargets.c -o gettargets
|
||||
|
||||
setselection: setselection.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` setselection.c -o setselection
|
||||
|
||||
clean:
|
||||
rm -f *.o gettargets setselection
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user