22#include <oslib/osspriteop.h>
23#include <oslib/wimp.h>
24#include <oslib/wimpspriteop.h>
44#define THEME_PANE_AREA 0
45#define THEME_DEFAULT_BUTTON 2
46#define THEME_CANCEL_BUTTON 3
47#define THEME_OK_BUTTON 4
61 wimp_WINDOW_NEW_FORMAT | wimp_WINDOW_VSCROLL | wimp_WINDOW_AUTO_REDRAW,
63 wimp_COLOUR_LIGHT_GREY,
64 wimp_COLOUR_LIGHT_GREY,
65 wimp_COLOUR_VERY_LIGHT_GREY,
66 wimp_COLOUR_DARK_GREY,
67 wimp_COLOUR_MID_LIGHT_GREY,
70 {0, -16384, 16384, 0},
71 wimp_ICON_TEXT | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED,
72 wimp_BUTTON_CLICK << wimp_ICON_BUTTON_TYPE_SHIFT,
96 wimp_window_state state;
97 wimp_icon_state icon_state;
107 NSLOG(netsurf, INFO,
"xwimp_create_window: 0x%x: %s",
108 error->errnum, error->errmess);
112 error = xwimp_get_window_state(&state);
114 NSLOG(netsurf, INFO,
"xwimp_get_window_state: 0x%x: %s",
115 error->errnum, error->errmess);
120 error = xwimp_get_icon_state(&icon_state);
122 NSLOG(netsurf, INFO,
"xwimp_get_icon_state: 0x%x: %s",
123 error->errnum, error->errmess);
127 state.visible.x1 = state.visible.x0 + icon_state.icon.extent.x1 - 16 -
129 state.visible.x0 += icon_state.icon.extent.x0 + 16;
130 state.visible.y0 = state.visible.y1 + icon_state.icon.extent.y0 + 16;
131 state.visible.y1 += icon_state.icon.extent.y1 - 28;
132 NSLOG(netsurf, INFO,
"Y0 = %i, y1 = %i", icon_state.icon.extent.y0,
133 icon_state.icon.extent.y1);
135 wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
136 << wimp_CHILD_XORIGIN_SHIFT |
137 wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT
138 << wimp_CHILD_YORIGIN_SHIFT |
139 wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
140 << wimp_CHILD_LS_EDGE_SHIFT |
141 wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT
142 << wimp_CHILD_BS_EDGE_SHIFT |
143 wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT
144 << wimp_CHILD_RS_EDGE_SHIFT |
145 wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT
146 << wimp_CHILD_TS_EDGE_SHIFT);
148 NSLOG(netsurf, INFO,
"xwimp_open_window_nested: 0x%x: %s",
149 error->errnum, error->errmess);
162 (
toolbar->descriptor == theme_choice));
184 NSLOG(netsurf, INFO,
"xwimp_delete_window: 0x%x: %s",
185 error->errnum, error->errmess);
201 theme_new =
toolbar->descriptor;
225 switch (pointer->i) {
231 (
toolbar->descriptor == theme_default));
246 os_box extent = { 0, 0, 0, 0 };
251 wimp_icon_create new_icon;
252 wimp_window_state state;
253 int parent_width, nested_y, min_extent, base_extent;
254 int *radio_icons, *radio_set;
265 while (descriptor != NULL) {
278 NSLOG(netsurf, INFO,
"No memory for calloc()");
288 while (link->
next) link = link->
next;
293 descriptor = descriptor->
next;
298 error = xwimp_get_window_state(&state);
300 NSLOG(netsurf, INFO,
"xwimp_get_window_state: 0x%x: %s",
301 error->errnum, error->errmess);
306 parent_width = state.visible.x1 - state.visible.x0;
307 min_extent = state.visible.y0 - state.visible.y1;
309 base_extent = state.visible.y1 - state.yscroll;
310 extent.x1 = parent_width;
313 new_icon.icon.flags = wimp_ICON_TEXT | wimp_ICON_INDIRECTED |
315 (wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) |
316 (wimp_COLOUR_VERY_LIGHT_GREY << wimp_ICON_BG_COLOUR_SHIFT);
319 int item_height = 44 + 44 + 16;
320 if (link->
next) item_height += 16;
322 extent.y0 = nested_y -
325 if (link->
next) extent.y0 -= 16;
326 if (extent.y0 > min_extent) extent.y0 = min_extent;
330 new_icon.icon.extent.x0 = 8;
331 new_icon.icon.extent.x1 = parent_width - 8;
332 new_icon.icon.flags &= ~wimp_ICON_BORDER;
333 new_icon.icon.flags |= wimp_ICON_SPRITE;
334 new_icon.icon.extent.y1 = nested_y -
336 new_icon.icon.extent.y0 = nested_y -
338 new_icon.icon.data.indirected_text_and_sprite.text =
340 new_icon.icon.data.indirected_text_and_sprite.size =
342 new_icon.icon.data.indirected_text_and_sprite.validation =
344 new_icon.icon.flags |= (wimp_BUTTON_RADIO <<
345 wimp_ICON_BUTTON_TYPE_SHIFT);
347 new_icon.icon.flags &= ~wimp_ICON_SPRITE;
348 new_icon.icon.extent.x0 = 52;
349 new_icon.icon.extent.y1 -= 44;
350 new_icon.icon.extent.y0 -= 44;
351 new_icon.icon.data.indirected_text.text =
353 new_icon.icon.data.indirected_text.size =
355 new_icon.icon.data.indirected_text.validation =
357 new_icon.icon.flags &= ~(wimp_BUTTON_RADIO <<
358 wimp_ICON_BUTTON_TYPE_SHIFT);
359 xwimp_create_icon(&new_icon, 0);
361 new_icon.icon.flags |= wimp_ICON_BORDER;
362 new_icon.icon.extent.x0 = -8;
363 new_icon.icon.extent.x1 = parent_width + 8;
364 new_icon.icon.extent.y1 -= 52;
365 new_icon.icon.extent.y0 = new_icon.icon.extent.y1 - 8;
366 new_icon.icon.data.indirected_text.text =
368 new_icon.icon.data.indirected_text.validation =
370 new_icon.icon.data.indirected_text.size = 1;
371 xwimp_create_icon(&new_icon, 0);
377 state.visible.y1 = nested_y + base_extent;
378 state.visible.y0 = state.visible.y1 -
381 wimp_CHILD_LINKS_PARENT_WORK_AREA
382 << wimp_CHILD_BS_EDGE_SHIFT |
383 wimp_CHILD_LINKS_PARENT_WORK_AREA
384 << wimp_CHILD_TS_EDGE_SHIFT);
393 radio_icons = (
int *)calloc(theme_count + 1,
sizeof(
int));
394 radio_set = radio_icons;
401 xwimp_force_redraw(
theme_pane, 0, -16384, 16384, 16384);
411 while ((
toolbar = next_toolbar) != NULL) {
static bool ro_gui_options_theme_click(wimp_pointer *pointer)
static wimp_window theme_pane_definition
bool ro_gui_options_theme_initialise(wimp_w w)
static char theme_radio_validation[]
#define THEME_DEFAULT_BUTTON
static bool ro_gui_options_theme_ok(wimp_w w)
void ro_gui_options_theme_finalise(wimp_w w)
static struct toolbar_display * toolbars
static void ro_gui_options_theme_load(void)
#define THEME_CANCEL_BUTTON
static struct theme_descriptor * theme_list
static char theme_line_validation[]
static void ro_gui_options_theme_free(void)
static char theme_null_validation[]
void ro_gui_save_options(void)
Save the current options.
Window themes(interface).
@ THEME_STYLE_BROWSER_TOOLBAR
#define NSLOG(catname, level, logmsg, args...)
Localised message support (interface).
nserror ro_warn_user(const char *warning, const char *detail)
Display a warning for a serious problem (eg memory exhaustion).
bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list)
Opens a theme ready for use.
void ro_gui_theme_close(struct theme_descriptor *descriptor, bool list)
Closes a theme after use.
struct theme_descriptor * ro_gui_theme_get_available(void)
Reads and caches the currently available themes.
struct theme_descriptor * ro_gui_theme_find(const char *leafname)
Finds a theme from the cached values.
bool ro_gui_theme_apply(struct theme_descriptor *descriptor)
Applies the theme to all current windows and subsequent ones.
Interface to utility string handling.
char * leafname
theme leafname
struct theme_descriptor * next
next descriptor in the list
char author[64]
theme author
Central repository for URL data (interface).
Option reading and saving interface.
#define nsoption_charp(OPTION)
Get the value of a string option.
#define nsoption_set_charp(OPTION, VALUE)
set string option in default table
void ro_gui_set_icon_selected_state(wimp_w w, wimp_i i, bool state)
Set the selected state of an icon.
bool ro_gui_get_icon_selected_state(wimp_w w, wimp_i i)
Gets the selected state of an icon.
int ro_get_vscroll_width(wimp_w w)
Gets the vertical scrollbar width.
General RISC OS WIMP/OS library functions (interface).
bool ro_gui_wimp_event_set_help_prefix(wimp_w w, const char *help_prefix)
Set the associated help prefix for a given window.
void ro_gui_wimp_event_finalise(wimp_w w)
Free any resources associated with a window.
bool ro_gui_wimp_event_register_cancel(wimp_w w, wimp_i i)
Register a function to be called for the Cancel action on a window.
bool ro_gui_wimp_event_memorise(wimp_w w)
Memorises the current state of any registered components in a window.
bool ro_gui_wimp_event_register_mouse_click(wimp_w w, bool(*callback)(wimp_pointer *pointer))
Register a function to be called for all mouse-clicks to icons in a window that don't have registered...
bool ro_gui_wimp_event_restore(wimp_w w)
Restore the state of any registered components in a window to their memorised state.
bool ro_gui_wimp_event_register_ok(wimp_w w, wimp_i i, bool(*callback)(wimp_w w))
Register a function to be called for the OK action on a window.
bool ro_gui_wimp_event_register_radio(wimp_w w, wimp_i *i)
Register a group of radio icons to be automatically handled.
Automated RISC OS WIMP event handling (interface).
A collection of grubby utilities for working with OSLib's wimp API.
#define PTR_WIMP_OPEN(pstate)