summaryrefslogtreecommitdiff
path: root/atari/toolbar.h
diff options
context:
space:
mode:
Diffstat (limited to 'atari/toolbar.h')
-rw-r--r--[-rwxr-xr-x]atari/toolbar.h148
1 files changed, 54 insertions, 94 deletions
diff --git a/atari/toolbar.h b/atari/toolbar.h
index 69908de35..3116aa9d6 100755..100644
--- a/atari/toolbar.h
+++ b/atari/toolbar.h
@@ -1,69 +1,26 @@
-/*
- * 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
+#ifndef NS_ATARI_TOOLBAR_H
#define NS_ATARI_TOOLBAR_H
+#include <stdbool.h>
+#include <stdint.h>
+
#include "desktop/textarea.h"
-#include "desktop/textinput.h"
-#include "content/hlcache.h"
-#include "atari/browser.h"
-
-#define TB_BUTTON_WIDTH 32
-#define THROBBER_WIDTH 32
-#define THROBBER_MIN_INDEX 1
-#define THROBBER_MAX_INDEX 12
-#define THROBBER_INACTIVE_INDEX 13
+#include "desktop/browser.h"
+
+struct s_toolbar;
+
+enum toolbar_textarea {
+ URL_INPUT_TEXT_AREA = 1
+};
-#define TOOLBAR_URL_MARGIN_LEFT 2
-#define TOOLBAR_URL_MARGIN_RIGHT 2
-#define TOOLBAR_URL_MARGIN_TOP 2
-#define TOOLBAR_URL_MARGIN_BOTTOM 2
-
-enum e_toolbar_button_states {
- button_on = 0,
- button_off = 1
-};
-#define TOOLBAR_BUTTON_NUM_STATES 2
-
-struct s_tb_button
-{
- short rsc_id;
- void (*cb_click)(struct gui_window * gw);
- COMPONENT * comp;
- hlcache_handle * icon[TOOLBAR_BUTTON_NUM_STATES];
- struct gui_window * gw;
- short state;
- short index;
-};
-
-
struct s_url_widget
{
- bool redraw; /* widget is only redrawn when this flag is set */
struct textarea *textarea;
- COMPONENT * comp;
- GRECT rdw_area;
-};
-
+ GRECT area;
+};
+
struct s_throbber_widget
{
- COMPONENT * comp;
short index;
short max_index;
bool running;
@@ -71,48 +28,51 @@ struct s_throbber_widget
struct s_toolbar
{
- COMPONENT * comp;
- struct gui_window * owner;
+ struct s_gui_win_root *owner;
struct s_url_widget url;
struct s_throbber_widget throbber;
- GRECT btdim;
+ OBJECT *form;
+ GRECT area;
/* size & location of buttons: */
struct s_tb_button * buttons;
- bool hidden;
int btcnt;
int style;
- bool redraw;
-};
+ bool attached;
+ bool reflow;
+ bool visible;
+ bool search_visible;
+};
-/* interface to the toolbar */
-
-/* Must be called before any other toolbar function is called: */
-void toolbar_init( void );
-/*Must be called when netsurf exits to free toolbar resources: */
+
+void toolbar_init(void);
+struct s_toolbar *toolbar_create(struct s_gui_win_root *owner);
+void toolbar_destroy(struct s_toolbar * tb);
void toolbar_exit( void );
-CMP_TOOLBAR tb_create( struct gui_window * gw );
-void tb_destroy( CMP_TOOLBAR tb );
-/* recalculate size/position of nested controls within the toolbar: */
-void tb_adjust_size( struct gui_window * gw );
-/* 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. */
-void tb_update_buttons( struct gui_window * gw, short buttonid );
-/* 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: */
-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 );
-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 );
-
-#endif
+bool toolbar_text_input(struct s_toolbar *tb, char *text);
+bool toolbar_key_input(struct s_toolbar *tb, short nkc);
+void toolbar_mouse_input(struct s_toolbar *tb, short obj, short mbut);
+void toolbar_update_buttons(struct s_toolbar *tb, struct browser_window *bw,
+ short idx);
+void toolbar_get_grect(struct s_toolbar *tb, short which, GRECT *g);
+OBJECT *toolbar_get_form(struct s_toolbar *tb);
+struct textarea *toolbar_get_textarea(struct s_toolbar *tb,
+ enum toolbar_textarea which);
+void toolbar_set_throbber_state(struct s_toolbar *tb, bool active);
+void toolbar_set_attached(struct s_toolbar *tb, bool attached);
+void toolbar_set_visible(struct s_toolbar *tb, short area, bool visible);
+void toolbar_set_reflow(struct s_toolbar *tb, bool do_reflow);
+void toolbar_set_width(struct s_toolbar *tb, short w);
+void toolbar_set_origin(struct s_toolbar *tb, short x, short y);
+void toolbar_set_dimensions(struct s_toolbar *tb, GRECT *area);
+void toolbar_set_url(struct s_toolbar *tb, const char *text);
+void toolbar_redraw(struct s_toolbar *tb, GRECT *clip);
+void toolbar_throbber_progress(struct s_toolbar *tb);
+/* public events handlers: */
+void toolbar_back_click(struct s_toolbar *tb);
+void toolbar_reload_click(struct s_toolbar *tb);
+void toolbar_forward_click(struct s_toolbar *tb);
+void toolbar_home_click(struct s_toolbar *tb);
+void toolbar_stop_click(struct s_toolbar *tb);
+
+
+#endif