Merge branch 'master' of ssh://pege77@mercury.wipsl.com/var/git/irreco-theme-editor
[irreco.git] / irreco / src / core / irreco_cmd.h
blob651b07ede630a14118b710c79b43b3f424e5cdce
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 IrrecoCmd
22 * @{
25 /**
26 * @file
27 * Header file of @ref IrrecoCmd.
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_COMMAND_H_TYPEDEF__
40 #define __IRRECO_COMMAND_H_TYPEDEF__
42 typedef union _IrrecoCmd IrrecoCmd;
43 typedef struct _IrrecoCmdTypeBackend IrrecoCmdTypeBackend;
44 typedef struct _IrrecoCmdTypeLayout IrrecoCmdTypeLayout;
45 typedef struct _IrrecoCmdTypeWait IrrecoCmdTypeWait;
46 typedef enum {
47 IRRECO_COMMAND_NONE,
48 IRRECO_COMMAND_NEXT_REMOTE,
49 IRRECO_COMMAND_PREVIOUS_REMOTE,
50 IRRECO_COMMAND_FULLSCREEN_TOGGLE,
51 IRRECO_COMMAND_BACKEND,
52 IRRECO_COMMAND_SHOW_LAYOUT,
53 IRRECO_COMMAND_WAIT
54 } IrrecoCmdType;
56 #endif /* __IRRECO_COMMAND_H_TYPEDEF__ */
60 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
61 /* Include */
62 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
63 #ifndef __IRRECO_COMMAND_H__
64 #define __IRRECO_COMMAND_H__
65 #include "irreco.h"
66 #include "irreco_data.h"
67 #include "irreco_backend_instance.h"
71 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
72 /* Datatypes */
73 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
75 struct _IrrecoCmdTypeBackend {
76 IrrecoCmdType type;
77 GString *title;
78 IrrecoBackendInstance *instance;
79 gchar *device_name;
80 gchar *command_name;
83 struct _IrrecoCmdTypeLayout {
84 IrrecoCmdType type;
85 GString *title;
86 gchar *name;
89 struct _IrrecoCmdTypeWait {
90 IrrecoCmdType type;
91 GString *title;
92 gulong delay;
95 union _IrrecoCmd {
96 IrrecoCmdType type;
97 IrrecoCmdTypeBackend backend;
98 IrrecoCmdTypeLayout layout;
99 IrrecoCmdTypeWait wait;
103 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
104 /* Defines. */
105 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
106 #define IRRECO_COMMAND_NONE_TITLE "None"
107 #define IRRECO_COMMAND_NEXT_REMOTE_TITLE "Next remote"
108 #define IRRECO_COMMAND_PREVIOUS_REMOTE_TITLE "Previous remote"
109 #define IRRECO_COMMAND_FULLSCREEN_TOGGLE_TITLE "Fullscreen toggle"
110 #define IRRECO_COMMAND_FULLSCREEN_TOGGLE_NAME "Fullscreen"
111 #define IRRECO_COMMAND_SHOW_LAYOUT_TITLE_PREFIX "Show remote: "
112 #define IRRECO_COMMAND_WAIT_TITLE_FORMAT "Wait %.1f seconds"
114 #define IRRECO_COMMAND_NONE_STRING "none"
115 #define IRRECO_COMMAND_NEXT_REMOTE_STRING "next-remote"
116 #define IRRECO_COMMAND_PREVIOUS_REMOTE_STRING "previous-remote"
117 #define IRRECO_COMMAND_FULLSCREEN_TOGGLE_STRING "fullscreen-toggle"
118 #define IRRECO_COMMAND_SHOW_BACKEND_STRING "backend"
119 #define IRRECO_COMMAND_SHOW_LAYOUT_STRING "show-layout"
120 #define IRRECO_COMMAND_WAIT_STRING "wait"
124 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
125 /* Prototypes */
126 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
127 IrrecoCmd *irreco_cmd_create();
128 void irreco_cmd_destroy(IrrecoCmd * irreco_cmd);
129 void irreco_cmd_set_builtin(IrrecoCmd * irreco_cmd,
130 IrrecoCmdType type);
131 void irreco_cmd_set_backend(IrrecoCmd * irreco_cmd,
132 IrrecoBackendInstance * instance,
133 const gchar * device_name,
134 const gchar * command_name);
135 void irreco_cmd_set_layout(IrrecoCmd * irreco_cmd,
136 const gchar * name);
137 void irreco_cmd_set_wait(IrrecoCmd * irreco_cmd, gulong delay);
138 void irreco_cmd_copy(IrrecoCmd * from, IrrecoCmd * to);
139 IrrecoCmd *irreco_cmd_dublicate(IrrecoCmd * old);
140 const gchar *irreco_cmd_get_long_name(IrrecoCmd * irreco_cmd);
141 const gchar *irreco_cmd_get_short_name(IrrecoCmd * irreco_cmd);
142 void irreco_cmd_print(IrrecoCmd * irreco_cmd);
143 gboolean irreco_cmd_execute(IrrecoCmd * irreco_cmd, IrrecoData * irreco_data);
145 const gchar *irreco_cmd_type_to_str(IrrecoCmdType type);
146 IrrecoCmdType irreco_cmd_str_to_type(const gchar * type);
147 void irreco_cmd_to_keyfile(IrrecoCmd *command,
148 GKeyFile *keyfile,
149 const gchar *group);
150 IrrecoCmd* irreco_cmd_from_keyfile(IrrecoData * irreco_data,
151 IrrecoKeyFile * keyfile);
154 #endif /* __IRRECO_COMMAND_H__ */
156 /** @} */