summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2006-07-15 15:39:33 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2006-07-15 15:39:33 +0000
commit546bf17a7f78e6727a3ae0384cba23633d1c8d98 (patch)
tree4f4b8a33d655ce82c3cd972b56713d8c2e8c9e37 /riscos
parent4c564c28bfa6af46e64efa5f23311c082c7108be (diff)
downloadnetsurf-546bf17a7f78e6727a3ae0384cba23633d1c8d98.tar.gz
netsurf-546bf17a7f78e6727a3ae0384cba23633d1c8d98.tar.bz2
Add relevent extensions to allow treeviews to be used as an embedded list component.
svn path=/trunk/netsurf/; revision=2753
Diffstat (limited to 'riscos')
-rw-r--r--riscos/global_history.c2
-rw-r--r--riscos/treeview.c62
-rw-r--r--riscos/wimp.c6
3 files changed, 49 insertions, 21 deletions
diff --git a/riscos/global_history.c b/riscos/global_history.c
index c16eea498..c5916aa10 100644
--- a/riscos/global_history.c
+++ b/riscos/global_history.c
@@ -314,7 +314,7 @@ bool global_history_add_internal(const char *url,
tree_link_node(link, parent, before);
if (!global_history_init) {
- tree_recalculate_node_positions(
+ tree_recalculate_node_positions(global_history_tree,
global_history_tree->root);
tree_redraw_area(global_history_tree,
0, 0, 16384, 16384);
diff --git a/riscos/treeview.c b/riscos/treeview.c
index f6f7903d3..a01c9b01c 100644
--- a/riscos/treeview.c
+++ b/riscos/treeview.c
@@ -344,23 +344,25 @@ void tree_draw_node_element(struct tree *tree, struct node_element *element) {
0xffffff,
false, false, false,
IMAGE_PLOT_TINCT_OPAQUE);
- tree_draw_line(element->box.x,
- element->box.y,
- element->box.width - 1,
- 0);
- tree_draw_line(element->box.x,
- element->box.y,
- 0,
- element->box.height - 3);
- tree_draw_line(element->box.x,
- element->box.y + element->box.height - 3,
- element->box.width - 1,
- 0);
- tree_draw_line(element->box.x + element->box.width - 1,
- element->box.y,
- 0,
- element->box.height - 3);
- }
+ if (!tree->no_furniture) {
+ tree_draw_line(element->box.x,
+ element->box.y,
+ element->box.width - 1,
+ 0);
+ tree_draw_line(element->box.x,
+ element->box.y,
+ 0,
+ element->box.height - 3);
+ tree_draw_line(element->box.x,
+ element->box.y + element->box.height - 3,
+ element->box.width - 1,
+ 0);
+ tree_draw_line(element->box.x + element->box.width - 1,
+ element->box.y,
+ 0,
+ element->box.height - 3);
+ }
+ }
break;
}
}
@@ -716,6 +718,10 @@ bool ro_gui_tree_click(wimp_pointer *pointer, struct tree *tree) {
/* no item either means cancel selection on (select) click or a drag */
if (!element) {
+ if (tree->single_selection) {
+ tree_set_node_selected(tree, tree->root->child, false);
+ return true;
+ }
if ((pointer->buttons == (wimp_CLICK_SELECT << 4)) ||
(pointer->buttons == (wimp_CLICK_SELECT << 8)))
tree_set_node_selected(tree, tree->root->child, false);
@@ -824,7 +830,9 @@ bool ro_gui_tree_click(wimp_pointer *pointer, struct tree *tree) {
}
/* single click (select) cancels current selection and selects item */
- if (pointer->buttons == (wimp_CLICK_SELECT << 8)) {
+ if ((pointer->buttons == (wimp_CLICK_SELECT << 8)) ||
+ ((pointer->buttons == (wimp_CLICK_ADJUST << 8)) &&
+ (tree->single_selection))) {
if (!node->selected) {
tree_set_node_selected(tree, tree->root->child, false);
node->selected = true;
@@ -843,6 +851,8 @@ bool ro_gui_tree_click(wimp_pointer *pointer, struct tree *tree) {
/* drag starts a drag operation */
if ((!tree->editing) && ((pointer->buttons == (wimp_CLICK_SELECT << 4)) ||
(pointer->buttons == (wimp_CLICK_ADJUST << 4)))) {
+ if (tree->single_selection)
+ return true;
if (!node->selected) {
node->selected = true;
@@ -1159,6 +1169,7 @@ void ro_gui_tree_open(wimp_open *open) {
int width;
int height;
int toolbar_height = 0;
+ bool vscroll;
tree = (struct tree *)ro_gui_wimp_event_get_user_data(open->w);
@@ -1182,6 +1193,21 @@ void ro_gui_tree_open(wimp_open *open) {
error->errnum, error->errmess));
warn_user("WimpError", error->errmess);
}
+
+ /* hide the scroll bar? */
+ if ((tree->no_vscroll) && (height != tree->window_height)) {
+ vscroll = (tree->height > height);
+ if (ro_gui_wimp_check_window_furniture(open->w,
+ wimp_WINDOW_VSCROLL) != vscroll) {
+ ro_gui_wimp_update_window_furniture(open->w,
+ 0, wimp_WINDOW_VSCROLL);
+ if (vscroll)
+ open->visible.x1 -= ro_get_vscroll_width(open->w);
+ else
+ open->visible.x1 += ro_get_vscroll_width(open->w);
+ }
+ }
+
tree->window_width = width;
tree->window_height = height;
}
diff --git a/riscos/wimp.c b/riscos/wimp.c
index 25eb8bf50..6ca288101 100644
--- a/riscos/wimp.c
+++ b/riscos/wimp.c
@@ -868,11 +868,13 @@ void ro_gui_user_redraw(wimp_draw *redraw, bool user_fill,
void ro_gui_wimp_update_window_furniture(wimp_w w, wimp_window_flags bic_mask,
wimp_window_flags xor_mask) {
wimp_window_state state;
+ wimp_w parent;
+ bits linkage;
os_error *error;
bool open;
state.w = w;
- error = xwimp_get_window_state(&state);
+ error = xwimp_get_window_state_and_nesting(&state, &parent, &linkage);
if (error) {
LOG(("xwimp_get_window_state: 0x%x: %s",
error->errnum, error->errmess));
@@ -886,7 +888,7 @@ void ro_gui_wimp_update_window_furniture(wimp_w w, wimp_window_flags bic_mask,
state.flags ^= xor_mask;
if (!open)
state.next = wimp_HIDDEN;
- error = xwimp_open_window_nested_with_flags(&state, (wimp_w)-1, 0);
+ error = xwimp_open_window_nested_with_flags(&state, parent, linkage);
if (error) {
LOG(("xwimp_open_window: 0x%x: %s",
error->errnum, error->errmess));