Added scrolled window
[irreco.git] / irreco / src / core / irreco_button_layout.h
blob50adeb1b4f2472881826b4ab1af140193129adde
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 IrrecoButtonLayout
22 * @{
25 /**
26 * @file
27 * Header file of @ref IrrecoButtonLayout.
31 * DO NOT INCLUDE THIS FILE, INCLUDE BUTTON.H INSTEAD.
33 #ifndef __IRRECO_BUTTON_H__
34 #include "irreco_button.h"
35 #endif
39 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
40 /* Datatypes */
41 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
42 #ifndef __IRRECO_BUTTON_LAYOUT_H__
43 #define __IRRECO_BUTTON_LAYOUT_H__
45 extern const gchar *irreco_button_layout_default_image;
46 extern const GdkColor irreco_button_layout_default_color;
49 * Button layout data.
51 * Used mainly to store and manage an array of buttons.
53 struct _IrrecoButtonLayout
55 /* Layout name. */
56 GString *name;
57 IrrecoButtonLayoutBgType background_type;
58 GString *background_image;
59 GdkColor background_color;
60 IrrecoHardkeyMap *hardkey_map;
62 /* Widget area. */
63 GtkWidget *container;
64 gint width;
65 gint height;
67 /* Contains all IrrecoButton structures. */
68 GPtrArray *button_array;
70 /* Button event callbacks. */
71 IrrecoButtonCallback button_motion_callback;
72 IrrecoButtonCallback button_press_callback;
73 IrrecoButtonCallback button_release_callback;
74 gpointer callback_user_data;
79 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
80 /* Macro */
81 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
82 #define irreco_button_layout_set_motion_callback(layout, callback) \
83 layout->button_motion_callback = IRRECO_BUTTON_CALLBACK(callback)
84 #define irreco_button_layout_set_press_callback(layout, callback) \
85 layout->button_press_callback = IRRECO_BUTTON_CALLBACK(callback)
86 #define irreco_button_layout_set_release_callback(layout, callback) \
87 layout->button_release_callback = IRRECO_BUTTON_CALLBACK(callback)
88 #define irreco_button_layout_set_callback_data(layout, data) \
89 layout->callback_user_data = data;
90 #define irreco_button_layout_get_callback_data(layout) \
91 ((layout)->callback_user_data)
92 #define irreco_button_layout_get_name(layout) \
93 ((layout)->name->str)
94 #define irreco_button_layout_get_bg_type(layout) \
95 ((layout)->background_type)
96 #define irreco_button_layout_get_bg_color(layout) \
97 (&(layout)->background_color)
101 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
102 /* Prototypes */
103 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
104 IrrecoButtonLayout *irreco_button_layout_create(GtkWidget * container,
105 IrrecoCmdChainManager *manager);
106 void irreco_button_layout_destroy(IrrecoButtonLayout * irreco_layout);
107 void irreco_button_layout_set_name(IrrecoButtonLayout * irreco_layout,
108 const gchar * name);
109 void irreco_button_layout_set_bg_type(IrrecoButtonLayout * irreco_layout,
110 IrrecoButtonLayoutBgType type);
111 void irreco_button_layout_set_bg_image(IrrecoButtonLayout * irreco_layout,
112 const gchar * background_image);
113 const gchar *
114 irreco_button_layout_get_bg_image(IrrecoButtonLayout * irreco_layout);
115 void irreco_button_layout_set_bg_color(IrrecoButtonLayout * irreco_layout,
116 const GdkColor * color);
117 void irreco_button_layout_get_bg(IrrecoButtonLayout * irreco_layout,
118 const gchar ** image,
119 const GdkColor ** color);
120 void irreco_button_layout_set_size(IrrecoButtonLayout * irreco_layout,
121 gint width, gint height);
122 void irreco_button_layout_set_container(IrrecoButtonLayout * irreco_layout,
123 GtkWidget * container);
124 void irreco_button_layout_container_put(IrrecoButtonLayout * irreco_layout,
125 GtkWidget *child_widget,
126 gint x, gint y);
127 void irreco_button_layout_container_move(IrrecoButtonLayout * irreco_layout,
128 GtkWidget *child_widget,
129 gint x, gint y);
130 void irreco_button_layout_reset(IrrecoButtonLayout * irreco_layout);
131 void irreco_button_layout_destroy_buttons(IrrecoButtonLayout * irreco_layout);
132 void irreco_button_layout_destroy_widgets(IrrecoButtonLayout * irreco_layout);
133 void irreco_button_layout_create_widgets(IrrecoButtonLayout * irreco_layout);
134 void irreco_button_layout_validate_positions(IrrecoButtonLayout * irreco_layout);
135 void irreco_button_layout_reindex(IrrecoButtonLayout * irreco_layout);
136 void irreco_button_layout_buttons_up(IrrecoButtonLayout * irreco_layout);
140 #endif /* __IRRECO_BUTTON_LAYOUT_H__ */
142 /** @} */