mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-02-17 15:04:18 +03:00
[project @ 2004-07-11 21:45:51 by rjw]
Inversion of hotlist icon functionality. Automatic placement of caret for dialog windows. Escape closes dialog windows. svn path=/import/netsurf/; revision=1071
This commit is contained in:
parent
89a23311ea
commit
6e3995cc65
@ -214,6 +214,10 @@ void ro_gui_dialog_open(wimp_w w)
|
||||
open.visible.y1 = screen_y + dy;
|
||||
open.next = wimp_TOP;
|
||||
wimp_open_window((wimp_open *) &open);
|
||||
|
||||
/* Set the caret position
|
||||
*/
|
||||
ro_gui_set_caret_first(w);
|
||||
}
|
||||
|
||||
|
||||
@ -252,6 +256,10 @@ void ro_gui_dialog_open_persistant(wimp_w parent, wimp_w w) {
|
||||
open.next = wimp_TOP;
|
||||
wimp_open_window((wimp_open *) &open);
|
||||
|
||||
/* Set the caret position
|
||||
*/
|
||||
ro_gui_set_caret_first(w);
|
||||
|
||||
/* Add a mapping
|
||||
*/
|
||||
if (parent == NULL) return;
|
||||
@ -295,6 +303,12 @@ void ro_gui_dialog_close_persistant(wimp_w parent) {
|
||||
|
||||
bool ro_gui_dialog_keypress(wimp_key *key)
|
||||
{
|
||||
|
||||
if (key->c == wimp_KEY_ESCAPE) {
|
||||
ro_gui_dialog_close(key->w);
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef WITH_AUTH
|
||||
if (key->w == dialog_401li)
|
||||
return ro_gui_401login_keypress(key);
|
||||
|
@ -270,6 +270,53 @@ void ro_gui_set_window_title(wimp_w w, const char *text) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Places the caret in the first available icon
|
||||
*/
|
||||
void ro_gui_set_caret_first(wimp_w w) {
|
||||
int icon, button;
|
||||
wimp_window_info_base window;
|
||||
wimp_icon_state state;
|
||||
os_error *error;
|
||||
|
||||
/* Get the window details
|
||||
*/
|
||||
window.w = w;
|
||||
error = xwimp_get_window_info_header_only((wimp_window_info *)&window);
|
||||
if (error) {
|
||||
LOG(("xwimp_get_window_info: 0x%x: %s",
|
||||
error->errnum, error->errmess));
|
||||
warn_user("WimpError", error->errmess);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Work through our icons
|
||||
*/
|
||||
state.w = w;
|
||||
for (icon = 0; icon < window.icon_count; icon++) {
|
||||
/* Get the icon state
|
||||
*/
|
||||
state.i = icon;
|
||||
error = xwimp_get_icon_state(&state);
|
||||
if (error) {
|
||||
LOG(("xwimp_get_window_info: 0x%x: %s",
|
||||
error->errnum, error->errmess));
|
||||
warn_user("WimpError", error->errmess);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check if it's writable
|
||||
*/
|
||||
button = (state.icon.flags >> wimp_ICON_BUTTON_TYPE_SHIFT) & 0xf;
|
||||
if ((button == wimp_BUTTON_WRITE_CLICK_DRAG) ||
|
||||
(button == wimp_BUTTON_WRITABLE)) {
|
||||
xwimp_set_caret_position(w, icon, 0, 0, -1, strlen(state.icon.data.indirected_text.text));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load a sprite file into memory.
|
||||
*
|
||||
|
@ -40,6 +40,7 @@ void ro_gui_set_icon_integer(wimp_w w, wimp_i i, int value);
|
||||
int ro_gui_get_icon_selected_state(wimp_w w, wimp_i i);
|
||||
#define ro_gui_set_icon_shaded_state(w, i, state) xwimp_set_icon_state(w, i, (state ? wimp_ICON_SHADED : 0), wimp_ICON_SHADED)
|
||||
void ro_gui_set_window_title(wimp_w w, const char *title);
|
||||
void ro_gui_set_caret_first(wimp_w w);
|
||||
|
||||
osspriteop_area *ro_gui_load_sprite_file(const char *pathname);
|
||||
bool ro_gui_wimp_sprite_exists(const char *sprite);
|
||||
|
@ -739,7 +739,7 @@ void ro_gui_toolbar_click(gui_window* g, wimp_pointer* pointer) {
|
||||
pointer->pos.x, pointer->pos.y);
|
||||
break;
|
||||
case ICON_TOOLBAR_BOOKMARK:
|
||||
if (pointer->buttons == wimp_CLICK_SELECT) {
|
||||
if (pointer->buttons == wimp_CLICK_ADJUST) {
|
||||
ro_gui_hotlist_add(g->title, g->data.browser.bw->current_content);
|
||||
} else {
|
||||
ro_gui_hotlist_show();
|
||||
|
Loading…
x
Reference in New Issue
Block a user