ce3b5812c75b407c8a84067b44cddcf6a44c3628
[hildon] / src / hildon-button.h
1 /*
2  * This file is a part of hildon
3  *
4  * Copyright (C) 2008 Nokia Corporation, all rights reserved.
5  *
6  * Contact: Karl Lattimer <karl.lattimer@nokia.com>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser Public License as published by
10  * the Free Software Foundation; version 2 of the license.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Lesser Public License for more details.
16  *
17  */
18
19 #ifndef                                         __HILDON_BUTTON_H__
20 #define                                         __HILDON_BUTTON_H__
21
22 #include <gtk/gtk.h>
23
24 G_BEGIN_DECLS
25
26 #define                                         HILDON_TYPE_BUTTON \
27                                                 (hildon_button_get_type())
28
29 #define                                         HILDON_BUTTON(obj) \
30                                                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
31                                                 HILDON_TYPE_BUTTON, HildonButton))
32
33 #define                                         HILDON_BUTTON_CLASS(klass) \
34                                                 (G_TYPE_CHECK_CLASS_CAST ((klass), \
35                                                 HILDON_TYPE_BUTTON, HildonButtonClass))
36
37 #define                                         HILDON_IS_BUTTON(obj) \
38                                                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HILDON_TYPE_BUTTON))
39
40 #define                                         HILDON_IS_BUTTON_CLASS(klass) \
41                                                 (G_TYPE_CHECK_CLASS_TYPE ((klass), HILDON_TYPE_BUTTON))
42
43 #define                                         HILDON_BUTTON_GET_CLASS(obj) \
44                                                 (G_TYPE_INSTANCE_GET_CLASS ((obj), \
45                                                 HILDON_TYPE_BUTTON, HildonButtonClass))
46
47 typedef struct                                  _HildonButton HildonButton;
48
49 typedef struct                                  _HildonButtonClass HildonButtonClass;
50
51 struct                                          _HildonButtonClass
52 {
53     GtkButtonClass parent_class;
54 };
55
56 struct                                          _HildonButton
57 {
58     GtkButton parent;
59 };
60
61 typedef enum {
62    HILDON_BUTTON_WITH_HORIZONTAL_VALUE          = 1,      /* adds second Label horizontally */
63    HILDON_BUTTON_WITH_VERTICAL_VALUE            = 2,      /* adds second Label vertically */
64    HILDON_BUTTON_AUTO_WIDTH                     = 0 << 2, /* leave width unset */
65    HILDON_BUTTON_HALFSCREEN_WIDTH               = 1 << 2, /* set to 50% screen width */
66    HILDON_BUTTON_FULLSCREEN_WIDTH               = 2 << 2, /* set to 100% screen width */
67    HILDON_BUTTON_AUTO_HEIGHT                    = 0 << 4, /* leave height unset */
68    HILDON_BUTTON_FINGER_HEIGHT                  = 1 << 4, /* set to finger height */
69    HILDON_BUTTON_THUMB_HEIGHT                   = 2 << 4, /* set to thumb height */
70 }                                               HildonButtonFlags;
71
72 GType
73 hildon_button_get_type                          (void) G_GNUC_CONST;
74
75 GtkWidget *
76 hildon_button_new                               (HildonButtonFlags flags,
77                                                  const char        *title,
78                                                  const char        *value);
79
80 GtkWidget *
81 hildon_button_new_full                          (HildonButtonFlags  flags,
82                                                  const char        *title,
83                                                  const char        *value,
84                                                  GtkSizeGroup      *title_size_group,
85                                                  GtkSizeGroup      *value_size_group);
86
87 void
88 hildon_button_set_title                         (HildonButton *button,
89                                                  const char *title);
90
91 void
92 hildon_button_set_value                         (HildonButton *button,
93                                                  const char *value);
94
95 const char *
96 hildon_button_get_title                         (HildonButton *button);
97
98 const char *
99 hildon_button_get_value                         (HildonButton *button);
100
101 void
102 hildon_button_set_title_and_value               (HildonButton *button,
103                                                  const char *title,
104                                                  const char *value);
105
106 void
107 hildon_button_set_size_groups                   (HildonButton *button,
108                                                  GtkSizeGroup *title_size_group,
109                                                  GtkSizeGroup *value_size_group);
110
111 G_END_DECLS
112
113 #endif /* __HILDON_BUTTON_H__ */