PageRenderTime 62ms CodeModel.GetById 30ms app.highlight 12ms RepoModel.GetById 18ms app.codeStats 0ms

/src/ftk_globals.c

http://ftk.googlecode.com/
C | 251 lines | 169 code | 53 blank | 29 comment | 0 complexity | 4c54658444858b2f82c846456c251849 MD5 | raw file
  1/*
  2 * File: ftk_globals.c    
  3 * Author:  Li XianJing <xianjimli@hotmail.com>
  4 * Brief: some global variables.  
  5 *
  6 * Copyright (c) 2009 - 2010  Li XianJing <xianjimli@hotmail.com>
  7 *
  8 * Licensed under the Academic Free License version 2.1
  9 *
 10 * This program is free software; you can redistribute it and/or modify
 11 * it under the terms of the GNU General Public License as published by
 12 * the Free Software Foundation; either version 2 of the License, or
 13 * (at your option) any later version.
 14 *
 15 * This program is distributed in the hope that it will be useful,
 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 18 * GNU General Public License for more details.
 19 *
 20 * You should have received a copy of the GNU General Public License
 21 * along with this program; if not, write to the Free Software
 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 23 */
 24
 25/*
 26 * History:
 27 * ================================================================
 28 * 2009-10-03 Li XianJing <xianjimli@hotmail.com> created
 29 *
 30 */
 31
 32#include "ftk_globals.h"
 33
 34struct _FtkGlobals
 35{
 36	FtkCanvas* canvas;
 37	FtkTheme* theme;
 38	FtkDisplay* display;
 39	FtkMainLoop* main_loop;
 40	FtkLogLevel  log_level;
 41	FtkWidget*   status_panel;
 42	FtkConfig*   config;
 43	FtkSource*   primary_source;
 44	FtkAllocator* allocator;
 45	FtkWndManager* wnd_manager;
 46	FtkTextLayout* text_layout;
 47	FtkBitmapFactory* bitmap_factory;
 48	FtkSourcesManager* sources_manager;
 49	FtkImPreeditor* input_method_preeditor;
 50	FtkAnimationTrigger* animation_trigger;
 51	FtkInputMethodManager* input_manager_manager;
 52}g_globals;
 53
 54FtkAnimationTrigger* ftk_default_animation_trigger(void)
 55{
 56	return g_globals.animation_trigger;
 57}
 58
 59FtkDisplay*       ftk_default_display(void)
 60{
 61	return g_globals.display;
 62}
 63
 64FtkCanvas*         ftk_shared_canvas(void)
 65{
 66	return g_globals.canvas;
 67}
 68
 69FtkTheme*          ftk_default_theme(void)
 70{
 71	return g_globals.theme;
 72}
 73
 74FtkSource*         ftk_primary_source(void)
 75{
 76	return g_globals.primary_source;
 77}
 78
 79FtkConfig*         ftk_default_config(void)
 80{
 81	return g_globals.config;
 82}
 83
 84FtkAllocator*      ftk_default_allocator(void)
 85{
 86	return g_globals.allocator;
 87}
 88
 89FtkTextLayout*     ftk_default_text_layout(void)
 90{
 91	return g_globals.text_layout;
 92}
 93
 94FtkImPreeditor* ftk_default_input_method_preeditor(void)
 95{
 96	return g_globals.input_method_preeditor;
 97}
 98
 99FtkInputMethodManager* ftk_default_input_method_manager(void)
100{
101	return g_globals.input_manager_manager;
102}
103
104FtkMainLoop*      ftk_default_main_loop(void)
105{
106	return g_globals.main_loop;
107}
108
109FtkLogLevel       ftk_default_log_level(void)
110{
111	return g_globals.log_level;
112}
113
114FtkWndManager*    ftk_default_wnd_manager(void)
115{
116	return g_globals.wnd_manager;
117}
118
119FtkWidget*        ftk_default_status_panel(void)
120{
121	return g_globals.status_panel;
122}
123
124FtkBitmapFactory* ftk_default_bitmap_factory(void)
125{
126	return g_globals.bitmap_factory;
127}
128
129FtkSourcesManager* ftk_default_sources_manager(void)
130{
131	return g_globals.sources_manager;
132}
133
134void ftk_set_animation_trigger(FtkAnimationTrigger* animation_trigger)
135{
136	g_globals.animation_trigger = animation_trigger;
137
138	return;
139}
140
141void ftk_set_display(FtkDisplay* display)
142{
143	g_globals.display = display;
144
145	return;
146}
147
148void ftk_set_main_loop(FtkMainLoop* main_loop)
149{
150	g_globals.main_loop = main_loop;
151
152	return;
153}
154
155void ftk_set_log_level(FtkLogLevel level)
156{
157	g_globals.log_level = level;
158
159	return;
160}
161
162void ftk_set_status_panel(FtkWidget* status_panel)
163{
164	g_globals.status_panel = status_panel;
165
166	return;
167}
168
169void ftk_set_wnd_manager(FtkWndManager* wnd_manager)
170{
171	g_globals.wnd_manager = wnd_manager;
172
173	return;
174}
175
176void ftk_set_bitmap_factory(FtkBitmapFactory* bitmap_factory)
177{
178	g_globals.bitmap_factory = bitmap_factory;
179
180	return;
181}
182
183void ftk_set_sources_manager(FtkSourcesManager* sources_manager)
184{
185	g_globals.sources_manager = sources_manager;
186
187	return;
188}
189
190void ftk_set_shared_canvas(FtkCanvas* canvas)
191{
192	g_globals.canvas = canvas;
193
194	return;
195}
196
197void ftk_set_theme(FtkTheme* theme)
198{
199	g_globals.theme = theme;
200
201	return;
202}
203
204void ftk_set_primary_source(FtkSource* source)
205{
206	g_globals.primary_source = source;
207
208	return;
209}
210
211void ftk_set_config(FtkConfig* config)
212{
213	g_globals.config = config;
214
215	return;
216}
217
218void ftk_set_allocator(FtkAllocator* allocator)
219{
220	g_globals.allocator = allocator;
221
222	return;
223}
224
225void ftk_set_text_layout(FtkTextLayout* text_layout)
226{
227	g_globals.text_layout = text_layout;
228
229	return;
230}
231
232void ftk_set_input_method_preeditor(FtkImPreeditor* input_method_preeditor)
233{
234	g_globals.input_method_preeditor = input_method_preeditor;
235
236	return;
237}
238
239void ftk_set_input_method_manager(FtkInputMethodManager* input_manager_manager)
240{
241	g_globals.input_manager_manager = input_manager_manager;
242
243	return;
244}
245
246void ftk_clear_globals(void)
247{
248	memset(&g_globals, 0, sizeof(g_globals));
249
250	return;
251}