NetSurf
Data Structures | Functions | Variables
treeview.c File Reference
#include "assert.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "netsurf/inttypes.h"
#include "netsurf/core_window.h"
#include "netsurf/plotters.h"
#include "atari/gui.h"
#include "atari/plot/plot.h"
#include "atari/misc.h"
#include "atari/gemtk/gemtk.h"
#include "atari/treeview.h"
#include "atari/res/netsurf.rsh"
Include dependency graph for treeview.c:

Go to the source code of this file.

Data Structures

struct  atari_treeview_window
 

Functions

static void atari_treeview_redraw_grect_request (struct core_window *cw, GRECT *area)
 Schedule a redraw of the treeview content. More...
 
static bool atari_treeview_is_iconified (struct core_window *cw)
 
static void atari_treeview_redraw_icon (struct core_window *cw, GRECT *clip)
 
static void __CDECL on_redraw_event (struct core_window *cw, EVMULT_OUT *ev_out, short msg[8])
 
static void __CDECL on_mbutton_event (struct core_window *cw, EVMULT_OUT *ev_out, short msg[8])
 
static void __CDECL on_keybd_event (struct core_window *cw, EVMULT_OUT *ev_out, short msg[8])
 
static short handle_event (GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
 GEMTK (netsurf's GEM toolkit) event sink. More...
 
static nserror atari_treeview_invalidate_area (struct core_window *cw, const struct rect *r)
 callback from core to request an invalidation of a window area. More...
 
static nserror atari_treeview_update_size (struct core_window *cw, int width, int height)
 Update the limits of the window. More...
 
static nserror atari_treeview_set_scroll (struct core_window *cw, int x, int y)
 Scroll the window to make area visible. More...
 
static nserror atari_treeview_get_scroll (const struct core_window *cw, int *x, int *y)
 
static nserror atari_treeview_get_window_dimensions (const struct core_window *cw, int *width, int *height)
 Get window viewport dimensions. More...
 
static nserror atari_treeview_drag_status (struct core_window *cw, core_window_drag_status ds)
 Inform corewindow owner of drag status. More...
 
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. More...
 
void atari_treeview_get_grect (struct core_window *cw, enum treeview_area_e mode, GRECT *dest)
 Get an specific area inside the window. More...
 
GUIWIN * atari_treeview_get_gemtk_window (struct core_window *cw)
 Get the window manager window handle. More...
 
void atari_treeview_redraw (struct core_window *cw)
 Process all pending redraw requests for a single treeview. More...
 
void atari_treeview_delete (struct core_window *cw)
 Free the Treeview, but not the gemtk window used for the treeview. More...
 
void atari_treeview_open (struct core_window *cw, GRECT *pos)
 Open the treeview window. More...
 
bool atari_treeview_is_open (struct core_window *cw)
 Returns the window "open" state. More...
 
void atari_treeview_set_user_data (struct core_window *cw, void *user_data_ptr)
 Attach arbitary user data to the treeview. More...
 
void * atari_treeview_get_user_data (struct core_window *cw)
 Return the arbitary user data set by atari_treeview_set_user_data() More...
 
void atari_treeview_close (struct core_window *cw)
 Closes (hides) the treeview window. More...
 
void atari_treeview_flush_redraws (void)
 Process all redraw request of all open Treeview windows. More...
 

Variables

static struct atari_treeview_windowtreeviews_open
 
static struct core_window_table cw_t
 Declare Core Window Callbacks: More...
 
struct core_window_tableatari_core_window_table = &cw_t
 

Function Documentation

◆ atari_treeview_close()

void atari_treeview_close ( struct core_window *  cw)

Closes (hides) the treeview window.

Definition at line 804 of file treeview.c.

References atari_treeview_window::is_open, atari_treeview_window::next_open, atari_treeview_window::prev_open, treeviews_open, and atari_treeview_window::window.

Referenced by atari_cookie_manager_close(), atari_global_history_close(), and atari_hotlist_close().

Here is the caller graph for this function:

◆ atari_treeview_create()

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 at line 547 of file treeview.c.

References atari_warn_user(), callbacks, handle_event(), atari_treeview_callbacks::init_phase2, atari_treeview_window::io, messages_get_errorcode(), NSERROR_NOMEM, NSERROR_OK, NSLOG, atari_treeview_window::user_data, and atari_treeview_window::window.

Referenced by atari_cookie_manager_init(), atari_global_history_init(), and atari_hotlist_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ atari_treeview_delete()

void atari_treeview_delete ( struct core_window *  cw)

Free the Treeview, but not the gemtk window used for the treeview.

Definition at line 740 of file treeview.c.

References atari_treeview_callbacks::finish, and atari_treeview_window::io.

Referenced by atari_cookie_manager_destroy(), atari_global_history_destroy(), and atari_hotlist_destroy().

Here is the caller graph for this function:

◆ atari_treeview_drag_status()

static nserror atari_treeview_drag_status ( struct core_window *  cw,
core_window_drag_status  ds 
)
static

Inform corewindow owner of drag status.

Parameters
cwthe core window object
dsthe current drag status

Definition at line 525 of file treeview.c.

References NSERROR_NOT_IMPLEMENTED.

◆ atari_treeview_flush_redraws()

void atari_treeview_flush_redraws ( void  )

Process all redraw request of all open Treeview windows.

Definition at line 825 of file treeview.c.

References atari_treeview_is_iconified(), atari_treeview_redraw(), atari_treeview_window::is_open, atari_treeview_window::redraw, and treeviews_open.

Referenced by atari_poll().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ atari_treeview_get_gemtk_window()

GUIWIN * atari_treeview_get_gemtk_window ( struct core_window *  cw)

Get the window manager window handle.

Definition at line 619 of file treeview.c.

References atari_treeview_window::window.

Referenced by handle_event().

Here is the caller graph for this function:

◆ atari_treeview_get_grect()

void atari_treeview_get_grect ( struct core_window *  cw,
enum treeview_area_e  mode,
GRECT *  dest 
)

Get an specific area inside the window.

Definition at line 602 of file treeview.c.

References mode, TREEVIEW_AREA_CONTENT, TREEVIEW_AREA_TOOLBAR, and atari_treeview_window::window.

Referenced by atari_treeview_get_window_dimensions(), atari_treeview_invalidate_area(), atari_treeview_update_size(), handle_event(), and on_redraw_event().

Here is the caller graph for this function:

◆ atari_treeview_get_scroll()

static nserror atari_treeview_get_scroll ( const struct core_window *  cw,
int *  x,
int *  y 
)
static

Definition at line 487 of file treeview.c.

References NSERROR_NOT_IMPLEMENTED.

◆ atari_treeview_get_user_data()

void * atari_treeview_get_user_data ( struct core_window *  cw)

Return the arbitary user data set by atari_treeview_set_user_data()

Definition at line 796 of file treeview.c.

References atari_treeview_window::user_data.

◆ atari_treeview_get_window_dimensions()

static nserror atari_treeview_get_window_dimensions ( const struct core_window *  cw,
int *  width,
int *  height 
)
static

Get window viewport dimensions.

Parameters
cwthe core window object
widthto be set to viewport width in px, if non NULL
heightto be set to viewport height in px, if non NULL

Definition at line 502 of file treeview.c.

References atari_treeview_get_grect(), height, NSERROR_OK, TREEVIEW_AREA_CONTENT, and width.

Here is the call graph for this function:

◆ atari_treeview_invalidate_area()

static nserror atari_treeview_invalidate_area ( struct core_window *  cw,
const struct rect r 
)
static

callback from core to request an invalidation of a window area.

The specified area of the window should now be considered out of date. If the area is NULL the entire window must be invalidated.

Parameters
[in]cwThe core window to invalidate.
[in]rarea to redraw or NULL for the entire window area.
Returns
NSERROR_OK on success or appropriate error code.

Definition at line 391 of file treeview.c.

References atari_treeview_get_grect(), atari_treeview_redraw_grect_request(), NSERROR_OK, RECT_TO_GRECT, TREEVIEW_AREA_CONTENT, atari_treeview_window::window, rect::y0, and rect::y1.

Here is the call graph for this function:

◆ atari_treeview_is_iconified()

static bool atari_treeview_is_iconified ( struct core_window *  cw)
static

Definition at line 107 of file treeview.c.

References atari_treeview_window::window.

Referenced by atari_treeview_flush_redraws(), and on_redraw_event().

Here is the caller graph for this function:

◆ atari_treeview_is_open()

bool atari_treeview_is_open ( struct core_window *  cw)

Returns the window "open" state.

Definition at line 780 of file treeview.c.

References atari_treeview_window::is_open.

Referenced by atari_cookie_manager_destroy(), atari_cookie_manager_open(), atari_global_history_destroy(), atari_global_history_open(), atari_hotlist_destroy(), and atari_hotlist_open().

Here is the caller graph for this function:

◆ atari_treeview_open()

void atari_treeview_open ( struct core_window *  cw,
GRECT *  pos 
)

Open the treeview window.

Definition at line 754 of file treeview.c.

References atari_treeview_window::is_open, atari_treeview_window::next_open, atari_treeview_window::prev_open, treeviews_open, and atari_treeview_window::window.

Referenced by atari_cookie_manager_open(), atari_global_history_open(), and atari_hotlist_open().

Here is the caller graph for this function:

◆ atari_treeview_redraw()

void atari_treeview_redraw ( struct core_window *  cw)

Process all pending redraw requests for a single treeview.

Definition at line 627 of file treeview.c.

References atari_plotters, clip(), atari_treeview_callbacks::draw, redraw_context::interactive, atari_treeview_window::io, atari_treeview_window::is_open, PLOT_FLAG_OFFSCREEN, plot_get_flags(), plot_get_vdi_handle(), plot_lock(), plot_set_dimensions(), plot_unlock(), atari_treeview_window::rdw_area, atari_treeview_window::redraw, and atari_treeview_window::window.

Referenced by atari_cookie_manager_redraw(), atari_global_history_redraw(), atari_hotlist_redraw(), atari_treeview_flush_redraws(), and on_mbutton_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ atari_treeview_redraw_grect_request()

static void atari_treeview_redraw_grect_request ( struct core_window *  cw,
GRECT *  area 
)
static

Schedule a redraw of the treeview content.

Definition at line 57 of file treeview.c.

References MIN, atari_treeview_window::rdw_area, and atari_treeview_window::redraw.

Referenced by atari_treeview_invalidate_area(), and on_redraw_event().

Here is the caller graph for this function:

◆ atari_treeview_redraw_icon()

static void atari_treeview_redraw_icon ( struct core_window *  cw,
GRECT *  clip 
)
static

Definition at line 115 of file treeview.c.

References atari_treeview_window::window.

Referenced by on_redraw_event().

Here is the caller graph for this function:

◆ atari_treeview_set_scroll()

static nserror atari_treeview_set_scroll ( struct core_window *  cw,
int  x,
int  y 
)
static

Scroll the window to make area visible.

Parameters
cwthe core window object
rrectangle to make visible

Definition at line 480 of file treeview.c.

References NSERROR_OK.

◆ atari_treeview_set_user_data()

void atari_treeview_set_user_data ( struct core_window *  cw,
void *  user_data_ptr 
)

Attach arbitary user data to the treeview.

Definition at line 788 of file treeview.c.

References atari_treeview_window::user_data.

◆ atari_treeview_update_size()

static nserror atari_treeview_update_size ( struct core_window *  cw,
int  width,
int  height 
)
static

Update the limits of the window.

Parameters
cwthe core window object
widththe width in px, or negative if don't care
heightthe height in px, or negative if don't care

Definition at line 430 of file treeview.c.

References atari_treeview_get_grect(), atari_treeview_window::disposing, atari_treeview_window::extent, height, NSERROR_INVALID, NSERROR_OK, TREEVIEW_AREA_CONTENT, width, atari_treeview_window::window, point_s::x, and point_s::y.

Here is the call graph for this function:

◆ handle_event()

static short handle_event ( GUIWIN *  win,
EVMULT_OUT *  ev_out,
short  msg[8] 
)
static

GEMTK (netsurf's GEM toolkit) event sink.

Definition at line 342 of file treeview.c.

References atari_treeview_callbacks::gemtk_user_func, atari_treeview_window::io, NSLOG, on_keybd_event(), on_mbutton_event(), and on_redraw_event().

Referenced by atari_treeview_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_keybd_event()

static void __CDECL on_keybd_event ( struct core_window *  cw,
EVMULT_OUT *  ev_out,
short  msg[8] 
)
static

Definition at line 312 of file treeview.c.

References atari_treeview_window::io, atari_treeview_callbacks::keypress, and nkc_to_input_key().

Referenced by handle_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_mbutton_event()

static void __CDECL on_mbutton_event ( struct core_window *  cw,
EVMULT_OUT *  ev_out,
short  msg[8] 
)
static

Definition at line 204 of file treeview.c.

References s_gem_cursors::arrow, atari_treeview_redraw(), BROWSER_MOUSE_CLICK_1, BROWSER_MOUSE_DOUBLE_CLICK, BROWSER_MOUSE_DRAG_1, BROWSER_MOUSE_DRAG_ON, BROWSER_MOUSE_HOLDING_1, BROWSER_MOUSE_HOVER, BROWSER_MOUSE_PRESS_1, gem_cursors, gem_set_cursor(), s_gem_cursors::hand, atari_treeview_window::io, atari_treeview_callbacks::mouse_action, atari_treeview_window::redraw, atari_treeview_window::startdrag, atari_treeview_window::window, point_s::x, and point_s::y.

Referenced by handle_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_redraw_event()

static void __CDECL on_redraw_event ( struct core_window *  cw,
EVMULT_OUT *  ev_out,
short  msg[8] 
)
static

Definition at line 145 of file treeview.c.

References atari_treeview_get_grect(), atari_treeview_is_iconified(), atari_treeview_redraw_grect_request(), atari_treeview_redraw_icon(), clip(), TREEVIEW_AREA_CONTENT, and atari_treeview_window::window.

Referenced by handle_event().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ atari_core_window_table

struct core_window_table* atari_core_window_table = &cw_t

Definition at line 543 of file treeview.c.

Referenced by main().

◆ cw_t

struct core_window_table cw_t
static
Initial value:
= {
}
static nserror atari_treeview_get_window_dimensions(const struct core_window *cw, int *width, int *height)
Get window viewport dimensions.
Definition: treeview.c:502
static nserror atari_treeview_invalidate_area(struct core_window *cw, const struct rect *r)
callback from core to request an invalidation of a window area.
Definition: treeview.c:391
static nserror atari_treeview_drag_status(struct core_window *cw, core_window_drag_status ds)
Inform corewindow owner of drag status.
Definition: treeview.c:525
static nserror atari_treeview_get_scroll(const struct core_window *cw, int *x, int *y)
Definition: treeview.c:487
static nserror atari_treeview_set_scroll(struct core_window *cw, int x, int y)
Scroll the window to make area visible.
Definition: treeview.c:480
static nserror atari_treeview_update_size(struct core_window *cw, int width, int height)
Update the limits of the window.
Definition: treeview.c:430

Declare Core Window Callbacks:

Definition at line 534 of file treeview.c.

◆ treeviews_open

struct atari_treeview_window* treeviews_open
static