NetSurf
treeview.h
Go to the documentation of this file.
1/*
2 * Copyright 2013 Ole Loots <ole@monochrom.net>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef NSATARI_TREEVIEW_H
20#define NSATARI_TREEVIEW_H
21
22#include "atari/gui.h"
23#include "atari/gemtk/gemtk.h"
24
26
27/**
28 * Default AES Window widgets for a treeview window, can be passed to
29 * atari_treeview_create as the flags parameter to have an standardized treeview
30 * window.
31 */
32#define ATARI_TREEVIEW_WIDGETS (CLOSER | MOVER | SIZER| NAME | FULLER | \
33 SMALLER | VSLIDE | HSLIDE | UPARROW | DNARROW | \
34 LFARROW | RTARROW)
35
40};
41
42struct core_window;
44
45/**
46 * The atari treeview implementation wraps the core_window callbacks
47 * So that it can process parameters and then it passes the event further
48 * To the specific implementation window.
49 * These callbacks must be implemented by any atari treeview window.
50 */
51
52/** \todo atari add drag_status callback */
53typedef nserror (*atari_treeview_init2_callback)(struct core_window *cw);
54typedef void (*atari_treeview_finish_callback)(struct core_window *cw);
55typedef void (*atari_treeview_keypress_callback)(struct core_window *cw, uint32_t ucs4);
56typedef void (*atari_treeview_mouse_action_callback)(struct core_window *cw, browser_mouse_state mouse, int x, int y);
57typedef void (*atari_treeview_draw_callback)(struct core_window *cw, int x, int y, struct rect *clip, const struct redraw_context *ctx);
58
65 gemtk_wm_event_handler_f gemtk_user_func;
66};
67
68/**
69 * Initalize an window to be an treeview window.
70 *
71 */
72struct core_window *atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks * callbacks, void * user_data, uint32_t flags);
73
74/**
75 * Free the Treeview, but not the gemtk window used for the treeview.
76 */
77void atari_treeview_delete(struct core_window *cw);
78
79/**
80 * Open the treeview window.
81 */
82void atari_treeview_open(struct core_window *cw, GRECT *pos);
83
84/**
85 * Returns the window "open" state.
86 */
87bool atari_treeview_is_open(struct core_window *cw);
88
89/**
90 * Closes (hides) the treeview window.
91 */
92void atari_treeview_close(struct core_window *cw);
93
94/**
95 * Get the window manager window handle
96 */
97
98GUIWIN * atari_treeview_get_gemtk_window(struct core_window *cw);
99
100/**
101 * Get an specific area inside the window.
102 */
103void atari_treeview_get_grect(struct core_window *cw, enum treeview_area_e mode, GRECT *dest);
104
105/**
106 * Process all pending redraw requests for a single treeview
107 */
108void atari_treeview_redraw(struct core_window *cw);
109
110/**
111 * Attach arbitary user data to the treeview.
112 */
113void atari_treeview_set_user_data(struct core_window *cw, void *user_data_ptr);
114
115/**
116 * Return the arbitary user data set by atari_treeview_set_user_data()
117 */
118void *atari_treeview_get_user_data(struct core_window *cw);
119
120/**
121 * Process all redraw request of all open Treeview windows
122 */
124
125#endif //NSATARI_TREEVIEW_H
static os_mode mode
The current sprite mode.
Definition: buffer.c:72
nserror
Enumeration of error codes.
Definition: errors.h:29
void atari_treeview_flush_redraws(void)
Process all redraw request of all open Treeview windows.
Definition: treeview.c:825
void * atari_treeview_get_user_data(struct core_window *cw)
Return the arbitary user data set by atari_treeview_set_user_data()
Definition: treeview.c:796
void atari_treeview_delete(struct core_window *cw)
Free the Treeview, but not the gemtk window used for the treeview.
Definition: treeview.c:740
void atari_treeview_get_grect(struct core_window *cw, enum treeview_area_e mode, GRECT *dest)
Get an specific area inside the window.
Definition: treeview.c:602
void(* atari_treeview_keypress_callback)(struct core_window *cw, uint32_t ucs4)
Definition: treeview.h:55
void(* atari_treeview_finish_callback)(struct core_window *cw)
Definition: treeview.h:54
bool atari_treeview_is_open(struct core_window *cw)
Returns the window "open" state.
Definition: treeview.c:780
void atari_treeview_redraw(struct core_window *cw)
Process all pending redraw requests for a single treeview.
Definition: treeview.c:627
void atari_treeview_close(struct core_window *cw)
Closes (hides) the treeview window.
Definition: treeview.c:804
void atari_treeview_set_user_data(struct core_window *cw, void *user_data_ptr)
Attach arbitary user data to the treeview.
Definition: treeview.c:788
treeview_area_e
Definition: treeview.h:36
@ TREEVIEW_AREA_WORK
Definition: treeview.h:37
@ TREEVIEW_AREA_CONTENT
Definition: treeview.h:39
@ TREEVIEW_AREA_TOOLBAR
Definition: treeview.h:38
GUIWIN * atari_treeview_get_gemtk_window(struct core_window *cw)
Get the window manager window handle.
Definition: treeview.c:619
struct core_window * atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks *callbacks, void *user_data, uint32_t flags)
Initalize an window to be an treeview window.
Definition: treeview.c:547
void atari_treeview_open(struct core_window *cw, GRECT *pos)
Open the treeview window.
Definition: treeview.c:754
nserror(* atari_treeview_init2_callback)(struct core_window *cw)
The atari treeview implementation wraps the core_window callbacks So that it can process parameters a...
Definition: treeview.h:53
struct core_window_table * atari_core_window_table
Definition: treeview.c:543
void(* atari_treeview_draw_callback)(struct core_window *cw, int x, int y, struct rect *clip, const struct redraw_context *ctx)
Definition: treeview.h:57
void(* atari_treeview_mouse_action_callback)(struct core_window *cw, browser_mouse_state mouse, int x, int y)
Definition: treeview.h:56
browser_mouse_state
Mouse state: 1 is primary mouse button.
Definition: mouse.h:52
static BList * callbacks
List of all callbacks.
Definition: schedule.cpp:44
atari_treeview_mouse_action_callback mouse_action
Definition: treeview.h:64
gemtk_wm_event_handler_f gemtk_user_func
Definition: treeview.h:65
atari_treeview_init2_callback init_phase2
Definition: treeview.h:60
atari_treeview_keypress_callback keypress
Definition: treeview.h:63
atari_treeview_finish_callback finish
Definition: treeview.h:61
atari_treeview_draw_callback draw
Definition: treeview.h:62
Core user interface window function table.
Definition: core_window.h:53
Rectangle coordinates.
Definition: types.h:40
Redraw context.
Definition: plotters.h:51
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
Definition: plot.c:357