2011-01-06 00:02:22 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2010 Ole Loots <ole@monochrom.net>
|
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef NS_ATARI_TOOLBAR_H
|
2011-11-29 03:23:28 +04:00
|
|
|
#define NS_ATARI_TOOLBAR_H
|
|
|
|
|
|
|
|
#include "desktop/textarea.h"
|
|
|
|
#include "desktop/textinput.h"
|
2012-04-11 03:12:13 +04:00
|
|
|
#include "content/hlcache.h"
|
2012-07-11 01:35:24 +04:00
|
|
|
#include "atari/browser.h"
|
2011-01-06 00:02:22 +03:00
|
|
|
|
2011-05-10 02:10:02 +04:00
|
|
|
#define TB_BUTTON_WIDTH 32
|
|
|
|
#define THROBBER_WIDTH 32
|
2011-02-02 00:25:10 +03:00
|
|
|
#define THROBBER_MIN_INDEX 1
|
|
|
|
#define THROBBER_MAX_INDEX 12
|
|
|
|
#define THROBBER_INACTIVE_INDEX 13
|
2011-11-29 03:23:28 +04:00
|
|
|
|
|
|
|
#define TOOLBAR_URL_MARGIN_LEFT 2
|
|
|
|
#define TOOLBAR_URL_MARGIN_RIGHT 2
|
|
|
|
#define TOOLBAR_URL_MARGIN_TOP 2
|
2012-04-11 03:12:13 +04:00
|
|
|
#define TOOLBAR_URL_MARGIN_BOTTOM 2
|
|
|
|
|
2012-05-13 19:32:35 +04:00
|
|
|
enum e_toolbar_button_states {
|
|
|
|
button_on = 0,
|
|
|
|
button_off = 1
|
|
|
|
};
|
|
|
|
#define TOOLBAR_BUTTON_NUM_STATES 2
|
|
|
|
|
2011-05-10 02:10:02 +04:00
|
|
|
struct s_tb_button
|
|
|
|
{
|
|
|
|
short rsc_id;
|
2012-06-22 02:01:41 +04:00
|
|
|
void (*cb_click)(struct gui_window * gw);
|
2012-04-11 03:12:13 +04:00
|
|
|
COMPONENT * comp;
|
2012-05-13 19:32:35 +04:00
|
|
|
hlcache_handle * icon[TOOLBAR_BUTTON_NUM_STATES];
|
2012-04-11 03:12:13 +04:00
|
|
|
struct gui_window * gw;
|
2012-05-13 19:32:35 +04:00
|
|
|
short state;
|
|
|
|
short index;
|
2011-05-10 02:10:02 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct s_url_widget
|
|
|
|
{
|
|
|
|
bool redraw; /* widget is only redrawn when this flag is set */
|
2011-11-29 03:23:28 +04:00
|
|
|
struct text_area *textarea;
|
|
|
|
COMPONENT * comp;
|
|
|
|
GRECT rdw_area;
|
2011-05-10 02:10:02 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct s_throbber_widget
|
|
|
|
{
|
|
|
|
COMPONENT * comp;
|
|
|
|
short index;
|
|
|
|
short max_index;
|
|
|
|
bool running;
|
|
|
|
};
|
2011-11-29 03:23:28 +04:00
|
|
|
|
2011-05-10 02:10:02 +04:00
|
|
|
struct s_toolbar
|
|
|
|
{
|
|
|
|
COMPONENT * comp;
|
2011-11-29 03:23:28 +04:00
|
|
|
struct gui_window * owner;
|
2011-05-10 02:10:02 +04:00
|
|
|
struct s_url_widget url;
|
2011-11-29 03:23:28 +04:00
|
|
|
struct s_throbber_widget throbber;
|
|
|
|
GRECT btdim;
|
|
|
|
/* size & location of buttons: */
|
2012-01-12 00:35:50 +04:00
|
|
|
struct s_tb_button * buttons;
|
|
|
|
bool hidden;
|
2012-04-11 03:12:13 +04:00
|
|
|
int btcnt;
|
|
|
|
int style;
|
|
|
|
bool redraw;
|
2011-05-10 02:10:02 +04:00
|
|
|
};
|
2011-12-01 02:36:52 +04:00
|
|
|
|
2012-04-11 03:12:13 +04:00
|
|
|
/* interface to the toolbar */
|
|
|
|
|
|
|
|
/* Must be called before any other toolbar function is called: */
|
|
|
|
void toolbar_init( void );
|
2012-04-13 00:18:53 +04:00
|
|
|
/*Must be called when netsurf exits to free toolbar resources: */
|
|
|
|
void toolbar_exit( void );
|
2011-01-06 00:02:22 +03:00
|
|
|
CMP_TOOLBAR tb_create( struct gui_window * gw );
|
|
|
|
void tb_destroy( CMP_TOOLBAR tb );
|
2011-11-29 03:23:28 +04:00
|
|
|
/* recalculate size/position of nested controls within the toolbar: */
|
|
|
|
void tb_adjust_size( struct gui_window * gw );
|
2011-01-06 00:02:22 +03:00
|
|
|
/* report click to toolbar, relative coords : */
|
|
|
|
void tb_click( struct gui_window * gw, short mx, short my, short mb, short kstat );
|
|
|
|
void tb_back_click( struct gui_window * gw );
|
|
|
|
void tb_reload_click( struct gui_window * gw );
|
|
|
|
void tb_forward_click( struct gui_window * gw );
|
|
|
|
void tb_home_click( struct gui_window * gw );
|
|
|
|
void tb_stop_click( struct gui_window * gw );
|
|
|
|
/* enable / disable buttons etc. */
|
2012-04-11 03:12:13 +04:00
|
|
|
void tb_update_buttons( struct gui_window * gw, short buttonid );
|
2011-01-06 00:02:22 +03:00
|
|
|
/* handles clicks on url widget: */
|
|
|
|
void tb_url_click( struct gui_window * gw, short mx, short my, short mb, short kstat );
|
|
|
|
/* handle keybd event while url widget has focus:*/
|
|
|
|
bool tb_url_input( struct gui_window * gw, short keycode );
|
|
|
|
/* set the url: */
|
2011-11-29 03:23:28 +04:00
|
|
|
void tb_url_set( struct gui_window * gw, char * text );
|
|
|
|
/* perform redraw of invalidated url textinput areas: */
|
|
|
|
void tb_url_redraw( struct gui_window * gw );
|
2012-01-12 00:35:50 +04:00
|
|
|
struct gui_window * tb_gui_window( CMP_TOOLBAR tb );
|
|
|
|
/* hide toolbar, mode = 1: hide, mode = 0: show */
|
|
|
|
void tb_hide( struct gui_window * gw, short mode );
|
2011-01-06 00:02:22 +03:00
|
|
|
|
|
|
|
#endif
|