Merge branch 'master' of ssh://pege77@mercury.wipsl.com/var/git/irreco-theme-editor
[irreco.git] / irreco / src / core / irreco_button.h
blob5615356714f197fdead9aaab99d7d43f6f6a0dde
1 /*
2 * irreco - Ir Remote Control
3 * Copyright (C) 2007 Arto Karppinen (arto.karppinen@iki.fi)
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 /**
21 * @addtogroup IrrecoButton
22 * @{
25 /**
26 * @file
27 * Header file of @ref IrrecoButton.
30 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
31 /* Typedef */
32 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
34 * Make sure that typedefs are available before we include anything elese.
36 * This makes sure that whatever other structures that depend on structures
37 * defined in this file will compile OK recardles of header inclusion order.
39 #ifndef __IRRECO_BUTTON_H_TYPEDEF__
40 #define __IRRECO_BUTTON_H_TYPEDEF__
41 typedef struct _IrrecoButton IrrecoButton;
42 typedef struct _IrrecoButtonLayout IrrecoButtonLayout;
43 typedef void (*IrrecoButtonCallback) (IrrecoButton * irreco_button,
44 void * user_data);
45 typedef enum {
46 IRRECO_BACKGROUND_DEFAULT = 0,
47 IRRECO_BACKGROUND_COLOR,
48 IRRECO_BACKGROUND_IMAGE
49 } IrrecoButtonLayoutBgType;
51 #endif /* __IRRECO_BUTTON_H_TYPEDEF__ */
55 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
56 /* Include */
57 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
58 #ifndef __IRRECO_BUTTON_H__
59 #define __IRRECO_BUTTON_H__
60 #include "irreco.h"
61 #include "irreco_data.h"
62 #include "irreco_button_layout.h"
63 #include "irreco_cmd_chain_manager.h"
64 #include "irreco_hardkey_map.h"
65 #include "irreco_theme_button.h"
68 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
69 /* Datatypes */
70 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
73 * Button types.
75 typedef enum _IrrecoButtonType {
76 IRRECO_BTYPE_NONE = 0,
77 IRRECO_BTYPE_GTK_BUTTON, /* Vanilla GTK button. */
78 IRRECO_BTYPE_SINGLE_IMAGE, /* Image button without secondary image. */
79 IRRECO_BTYPE_DOUBLE_IMAGE /* Image button. */
80 } IrrecoButtonType;
83 * Button states.
85 typedef enum _IrrecoButtonState {
86 IRRECO_BSTATE_UP = 0,
87 IRRECO_BSTATE_DOWN,
88 IRRECO_BSTATE_FLASH
89 } IrrecoButtonState;
92 * Button specific data.
94 struct _IrrecoButton {
95 guint index;
97 /* Button configuration. */
98 IrrecoThemeButton *style;
99 gchar *title;
100 gchar *command;
101 gint x;
102 gint y;
103 IrrecoCmdChainManager *cmd_chain_manager;
104 IrrecoCmdChainId cmd_chain_id;
105 /*IrrecoCmdChain *cmd_chain;*/
107 /* Pointers. */
108 IrrecoButtonLayout *irreco_layout;
109 IrrecoButtonType type;
110 GtkWidget *widget;
111 GtkWidget *widget_up;
112 GtkWidget *widget_down;
113 GtkWidget *widget_label;
115 /* Widget state. */
116 IrrecoButtonState state;
117 gint width;
118 gint height;
120 /* Handlers. */
121 gulong motion_handler_id;
122 gulong press_handler_id;
123 gulong release_handler_id;
124 gulong destroy_handler_id;
125 gulong size_request_handler_id;
126 gulong extra_handler_id;
131 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
132 /* Prototypes */
133 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
134 IrrecoButton *irreco_button_create(IrrecoButtonLayout * irreco_layout,
135 gdouble x,
136 gdouble y,
137 const gchar * title,
138 IrrecoThemeButton * style,
139 IrrecoCmdChainManager * manager);
140 void irreco_button_destroy(IrrecoButton * irreco_button);
141 void irreco_button_set_title(IrrecoButton * irreco_button, const gchar * title);
142 void irreco_button_set_cmd_chain_id(IrrecoButton * irreco_button,
143 IrrecoCmdChainId cmd_chain_id);
144 void irreco_button_set_cmd_chain(IrrecoButton * irreco_button,
145 IrrecoCmdChain * cmd_chain);
146 IrrecoCmdChain *irreco_button_get_cmd_chain(IrrecoButton * irreco_button);
147 void irreco_button_set_style(IrrecoButton * irreco_button,
148 IrrecoThemeButton * style);
149 void irreco_button_create_widget(IrrecoButton * irreco_button);
150 void irreco_button_destroy_widget(IrrecoButton* irreco_button);
151 void irreco_button_down(IrrecoButton * irreco_button);
152 void irreco_button_up(IrrecoButton * irreco_button);
153 void irreco_button_move(IrrecoButton * irreco_button, gint * x, gint * y);
154 void irreco_button_to_front(IrrecoButton * irreco_button);
155 void irreco_button_flash(IrrecoButton * irreco_button);
156 void irreco_button_layout_set_name(IrrecoButtonLayout * irreco_layout,
157 const gchar * name);
158 void irreco_button_layout_set_size(IrrecoButtonLayout * irreco_layout, gint width,
159 gint height);
162 #endif /* __IRRECO_BUTTON_H__ */
164 /** @} */