5 #ifndef XUNI_GUARD_GRAPHICS_H
6 #define XUNI_GUARD_GRAPHICS_H
11 #include "resource/resource.h"
17 typedef size_t panel_type_t
;
32 int xclip
, yclip
, wclip
, hclip
;
37 struct scale_pos_t scale
;
38 struct clip_pos_t
*clip
;
63 struct axis_pos_t x
, y
, w
, h
;
68 struct xy_pos_t
*offset
;
69 struct xy_pos_t
*clip
;
87 /*struct string_t mononame, sansname;*/
88 struct font_data_t
*font
;
94 struct widget_t
*widget
;
97 struct widget_edit_t
{
98 struct label_t
*data
, *prev
; /* need to be widget_ts */
99 struct widget_t
*datawidget
;
100 size_t alloc
, len
, pos
;
103 struct widget_sel_t
{
115 struct widget_tab_t
{
121 struct widget_t
*widget
;
123 struct widget_sel_t sel
;
124 struct widget_edit_t edit
;
125 struct widget_p_t active
;
126 struct widget_tab_t tab
; /* !!! set, but not read from yet */
135 SDL_Cursor
*normal
, *text
;
140 struct widget_t
*current
;
141 struct cursors_t cursors
;
150 SDL_GrabMode restrictfocus
;
154 struct smode_t
*smode
;
155 /*struct font_t *font;*/
156 struct theme_t
*theme
;
158 struct wtype_array_t
*wtype
;
159 struct loadso_array_t
*loadso
;
162 typedef void (*xuni_callback_func_t
)(void *vdata
, struct xuni_t
*xuni
);
164 struct xuni_callback_t
{
166 xuni_callback_func_t func
;
169 void restrict_int(int *value
, int max
);
170 void restrict_pos(double *pos
);
171 void wrap_int(int *value
, int max
);
172 void init_smode(struct smode_t
*smode
, struct resource_t
*settings
);
173 void init_sdl_libraries(struct smode_t
*smode
, const char *icon
);
174 SDL_GrabMode
set_focus(SDL_GrabMode mode
);
175 int focus_in(Uint8 focus
);
176 int focus_changed(struct smode_t
*smode
, Uint8 focus
);
177 void quit_sdl_libraries(void);
178 void free_smode(struct smode_t
*smode
);
179 void free_theme(struct theme_t
*theme
);
180 void save_screenshot(SDL_Surface
*screen
);
181 void paint_cursor(struct xuni_t
*xuni
, struct widget_t
*cursor
);
182 void show_cursor(int enable
);
183 SDL_Surface
*load_image(const char *filename
);
184 int resize_screen(struct smode_t
*smode
, const SDL_ResizeEvent
*resize
);
185 int toggle_fullscreen(struct smode_t
*smode
);
186 void use_screen_mode(struct xuni_t
*xuni
, int width
, int height
);
187 void set_caption(const char *format
, ...)
188 #ifdef __GNUC__ /* enables printf()-style format string checking */
189 __attribute__ ((__format__ (__printf__
, 1, 2)))
192 SDL_Rect
**list_graphics_modes(struct smode_t
*smode
);
193 void lock_screen(SDL_Surface
*screen
);
194 void unlock_screen(SDL_Surface
*screen
);
195 void clear_screen(SDL_Surface
*screen
);
196 SDL_Surface
*new_surface(int w
, int h
, int d
, int alpha
);
197 void free_surface(SDL_Surface
*surface
);
198 void blit_surface(SDL_Surface
*screen
, SDL_Surface
*image
, int xp
, int yp
);
199 void blit_surface_area(SDL_Surface
*screen
, SDL_Surface
*image
,
200 int tx
, int ty
, int fx
, int fy
, int fw
, int fh
);
201 void blit_surface_repeat(SDL_Surface
*screen
, SDL_Surface
*image
,
202 int xp
, int yp
, int w
, int h
);
203 void blit_surface_repeat_area(SDL_Surface
*screen
, SDL_Surface
*image
,
204 int tx
, int ty
, int tw
, int th
, int fx
, int fy
, int fw
, int fh
);
205 void update_screen(struct xuni_t
*xuni
);
206 int in_rect(int xp
, int yp
, int x
, int y
, int w
, int h
);
207 int in_sdl_rect(int xp
, int yp
, const SDL_Rect
*r
);
208 int pos_in_rect(int xp
, int yp
, const struct pos_t
*pos
);
209 void blit_surface_fill_from(SDL_Surface
*screen
, SDL_Surface
*image
,
210 int tx
, int ty
, int tw
, int th
, int fx1
, int fy1
);
211 void fill_area(SDL_Surface
*screen
, int x
, int y
, int w
, int h
,
212 SDL_Surface
*image
, int ix
, int iy
);