use greyed images for forward back buttons as approprite

svn path=/trunk/netsurf/; revision=6819
This commit is contained in:
Vincent Sanders 2009-03-22 23:11:38 +00:00
parent 8db32fc061
commit 02761ee5e4
4 changed files with 68 additions and 14 deletions

View File

@ -18,6 +18,12 @@ FB_IMAGE_left_arrow := framebuffer/res/icons/back.png
FB_IMAGE_right_arrow := framebuffer/res/icons/forward.png
FB_IMAGE_reload := framebuffer/res/icons/reload.png
FB_IMAGE_stop_image := framebuffer/res/icons/stop.png
FB_IMAGE_left_arrow_g := framebuffer/res/icons/back_g.png
FB_IMAGE_right_arrow_g := framebuffer/res/icons/forward_g.png
FB_IMAGE_reload_g := framebuffer/res/icons/reload_g.png
FB_IMAGE_stop_image_g := framebuffer/res/icons/stop_g.png
FB_IMAGE_scrolll := framebuffer/res/icons/scrolll.png
FB_IMAGE_scrollr := framebuffer/res/icons/scrollr.png
FB_IMAGE_scrollu := framebuffer/res/icons/scrollu.png

View File

@ -470,18 +470,31 @@ fb_browser_window_input(fbtk_widget_t *widget, int value, void *pw)
return 0;
}
static void
fb_update_back_forward(struct gui_window *gw)
{
struct browser_window *bw = gw->bw;
fbtk_set_bitmap(gw->back,
(history_back_available(bw->history))? &left_arrow : &left_arrow_g);
fbtk_set_bitmap(gw->forward,
(history_forward_available(bw->history))? &right_arrow : &right_arrow_g);
}
/* left icon click routine */
static int
fb_leftarrow_click(fbtk_widget_t *widget,
browser_mouse_state st,
int x, int y, void *pw)
{
struct browser_window *bw = pw;
struct gui_window *gw =pw;
struct browser_window *bw = gw->bw;
if (st == BROWSER_MOUSE_CLICK_1) {
if (history_back_available(bw->history))
history_back(bw, bw->history);
}
fb_update_back_forward(gw);
return 0;
}
@ -490,12 +503,14 @@ fb_leftarrow_click(fbtk_widget_t *widget,
static int
fb_rightarrow_click(fbtk_widget_t *widget, browser_mouse_state st, int x, int y, void *pw)
{
struct browser_window *bw = pw;
struct gui_window *gw =pw;
struct browser_window *bw = gw->bw;
if (st == BROWSER_MOUSE_CLICK_1) {
if (history_forward_available(bw->history))
history_forward(bw, bw->history);
}
fb_update_back_forward(gw);
return 0;
}
@ -615,23 +630,45 @@ gui_create_browser_window(struct browser_window *bw,
LOG(("Normal window"));
/* fill toolbar background */
widget = fbtk_create_fill(gw->window, 0, 0, 0, 30, FB_FRAME_COLOUR);
widget = fbtk_create_fill(gw->window,
0, 0, 0, 30,
FB_FRAME_COLOUR);
fbtk_set_handler_move(widget, set_ptr_default_move, bw);
/* back button */
widget = fbtk_create_button(gw->window, 5, 2, FB_FRAME_COLOUR, &left_arrow, fb_leftarrow_click, bw);
fbtk_set_handler_move(widget, set_ptr_hand_move, bw);
gw->back = fbtk_create_button(gw->window,
5, 2,
FB_FRAME_COLOUR,
&left_arrow_g,
fb_leftarrow_click,
gw);
fbtk_set_handler_move(gw->back, set_ptr_hand_move, bw);
/* forward button */
widget = fbtk_create_button(gw->window, 35, 2, FB_FRAME_COLOUR, &right_arrow, fb_rightarrow_click, bw);
gw->forward = fbtk_create_button(gw->window,
35, 2,
FB_FRAME_COLOUR,
&right_arrow_g,
fb_rightarrow_click,
gw);
fbtk_set_handler_move(gw->forward, set_ptr_hand_move, bw);
/* reload button */
widget = fbtk_create_button(gw->window,
65, 2,
FB_FRAME_COLOUR,
&stop_image,
fb_stop_click,
bw);
fbtk_set_handler_move(widget, set_ptr_hand_move, bw);
/* reload button */
widget = fbtk_create_button(gw->window, 65, 2, FB_FRAME_COLOUR, &stop_image, fb_stop_click, bw);
fbtk_set_handler_move(widget, set_ptr_hand_move, bw);
/* reload button */
widget = fbtk_create_button(gw->window, 95, 2, FB_FRAME_COLOUR, &reload, fb_reload_click, bw);
widget = fbtk_create_button(gw->window,
95, 2,
FB_FRAME_COLOUR,
&reload,
fb_reload_click,
bw);
fbtk_set_handler_move(widget, set_ptr_hand_move, bw);
/* url widget */
@ -959,10 +996,13 @@ void gui_window_start_throbber(struct gui_window *g)
schedule(10, throbber_advance, g);
}
void gui_window_stop_throbber(struct gui_window *g)
void gui_window_stop_throbber(struct gui_window *gw)
{
g->throbber_index = -1;
fbtk_set_bitmap(g->throbber, &throbber0);
gw->throbber_index = -1;
fbtk_set_bitmap(gw->throbber, &throbber0);
fb_update_back_forward(gw);
}
void gui_window_place_caret(struct gui_window *g, int x, int y, int height)

View File

@ -41,7 +41,10 @@ typedef struct framebuffer_s {
struct gui_window {
struct browser_window *bw;
struct fbtk_widget_s *window;
struct fbtk_widget_s *back;
struct fbtk_widget_s *forward;
struct fbtk_widget_s *url;
struct fbtk_widget_s *status;
struct fbtk_widget_s *throbber;

View File

@ -25,6 +25,11 @@ extern struct bitmap left_arrow;
extern struct bitmap right_arrow;
extern struct bitmap reload;
extern struct bitmap stop_image;
extern struct bitmap left_arrow_g;
extern struct bitmap right_arrow_g;
extern struct bitmap reload_g;
extern struct bitmap stop_image_g;
extern struct bitmap scrolll;
extern struct bitmap scrollr;
extern struct bitmap scrollu;