]> git.sur5r.net Git - glabels/blob - src/wdgt-chain-button.h
Imported Upstream version 2.2.8
[glabels] / src / wdgt-chain-button.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
2
3 /* wdgt-chain-button.h
4  * Modified version of gimpchainbutton.h for gLabels:
5  *
6  * LIBGIMP - The GIMP Library
7  * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
8  *
9  * gimpchainbutton.h
10  * Copyright (C) 1999-2000 Sven Neumann <sven@gimp.org>
11  *
12  * Modified or gLabels by Jim Evins <evins@snaught.com>
13  *
14  * This library is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public
16  * License as published by the Free Software Foundation; either
17  * version 2 of the License, or (at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22  * General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public
25  * License along with this library; if not, write to the
26  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
27  * Boston, MA 02111-1307, USA.
28  */
29
30 /*
31  * This implements a widget derived from GtkTable that visualizes
32  * it's state with two different pixmaps showing a closed and a
33  * broken chain. It's intented to be used with the GimpSizeEntry
34  * widget. The usage is quite similar to the one the GtkToggleButton
35  * provides.
36  */
37
38 #ifndef __WDGT_CHAIN_BUTTON_H__
39 #define __WDGT_CHAIN_BUTTON_H__
40
41 #include <gtk/gtktable.h>
42
43 G_BEGIN_DECLS
44
45
46 typedef enum
47 {
48   GL_WDGT_CHAIN_TOP,
49   GL_WDGT_CHAIN_LEFT,
50   GL_WDGT_CHAIN_BOTTOM,
51   GL_WDGT_CHAIN_RIGHT
52 } glWdgtChainPosition;
53
54
55 #define GL_WDGT_TYPE_CHAIN_BUTTON            (gl_wdgt_chain_button_get_type ())
56 #define GL_WDGT_CHAIN_BUTTON(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_WDGT_TYPE_CHAIN_BUTTON, glWdgtChainButton))
57 #define GL_WDGT_CHAIN_BUTTON_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GL_WDGT_TYPE_CHAIN_BUTTON, glWdgtChainButtonClass))
58 #define GL_WDGT_IS_CHAIN_BUTTON(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_WDGT_TYPE_CHAIN_BUTTON))
59 #define GL_WDGT_IS_CHAIN_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_WDGT_TYPE_CHAIN_BUTTON))
60 #define GL_WDGT_CHAIN_BUTTON_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GL_WDGT_TYPE_CHAIN_BUTTON, glWdgtChainButtonClass))
61
62
63 typedef struct _glWdgtChainButton       glWdgtChainButton;
64 typedef struct _glWdgtChainButtonClass  glWdgtChainButtonClass;
65
66 struct _glWdgtChainButton
67 {
68   GtkTable           parent_instance;
69
70   glWdgtChainPosition  position;
71   gboolean           active;
72
73   GtkWidget         *button;
74   GtkWidget         *line1;
75   GtkWidget         *line2;
76   GtkWidget         *image;
77 };
78
79 struct _glWdgtChainButtonClass
80 {
81   GtkTableClass  parent_class;
82
83   void (* toggled)  (glWdgtChainButton *button);
84 };
85
86
87 GType       gl_wdgt_chain_button_get_type   (void) G_GNUC_CONST;
88
89 GtkWidget * gl_wdgt_chain_button_new        (glWdgtChainPosition  position);
90
91 void        gl_wdgt_chain_button_set_active (glWdgtChainButton   *button,
92                                              gboolean             active);
93 gboolean    gl_wdgt_chain_button_get_active (glWdgtChainButton   *button);
94
95
96 G_END_DECLS
97
98 #endif /* __WDGT_CHAIN_BUTTON_H__ */