2013-09-16 04:26:43 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2013 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/>.
|
2012-11-22 03:10:55 +04:00
|
|
|
*/
|
|
|
|
|
2013-09-16 04:26:43 +04:00
|
|
|
#ifndef NSATARI_TREEVIEW_H
|
|
|
|
#define NSATARI_TREEVIEW_H
|
|
|
|
|
2013-09-17 04:15:38 +04:00
|
|
|
#include "desktop/core_window.h"
|
2013-09-17 04:10:35 +04:00
|
|
|
#include "atari/gui.h"
|
|
|
|
#include "atari/gemtk/gemtk.h"
|
|
|
|
|
2013-09-26 03:24:49 +04:00
|
|
|
/**
|
|
|
|
* Default AES Window widgets for a treeview window, can be passed to
|
|
|
|
* atari_treeview_create as the flags parameter to have an standardized treeview
|
|
|
|
* window.
|
|
|
|
*/
|
2013-09-17 04:10:35 +04:00
|
|
|
#define ATARI_TREEVIEW_WIDGETS (CLOSER | MOVER | SIZER| NAME | FULLER | \
|
|
|
|
SMALLER | VSLIDE | HSLIDE | UPARROW | DNARROW \
|
|
|
|
| LFARROW | RTARROW)
|
|
|
|
|
2013-09-21 07:29:04 +04:00
|
|
|
enum treeview_area_e {
|
|
|
|
TREEVIEW_AREA_WORK = 0,
|
|
|
|
TREEVIEW_AREA_TOOLBAR,
|
|
|
|
TREEVIEW_AREA_CONTENT
|
|
|
|
};
|
2013-09-17 04:10:35 +04:00
|
|
|
|
|
|
|
struct core_window;
|
|
|
|
struct atari_treeview_window;
|
2013-09-21 07:29:04 +04:00
|
|
|
|
2013-09-26 03:24:49 +04:00
|
|
|
/**
|
|
|
|
* The atari treeview implementation wraps the core_window callbacks
|
|
|
|
* So that it can process parameters and then it passes the event further
|
|
|
|
* To the specific implementation window.
|
|
|
|
* These callbacks must be implemented by any atari treeview window.
|
|
|
|
*/
|
2013-09-17 04:10:35 +04:00
|
|
|
|
2013-09-26 03:24:49 +04:00
|
|
|
// TODO: add drag_status callback
|
2013-09-21 07:29:04 +04:00
|
|
|
typedef nserror (*atari_treeview_init2_callback)(struct core_window *cw,
|
|
|
|
struct core_window_callback_table * default_callbacks);
|
|
|
|
typedef void (*atari_treeview_finish_callback)(struct core_window *cw);
|
2013-09-17 04:10:35 +04:00
|
|
|
typedef void (*atari_treeview_keypress_callback)(struct core_window *cw,
|
2013-09-21 07:29:04 +04:00
|
|
|
uint32_t ucs4);
|
2013-09-17 04:10:35 +04:00
|
|
|
typedef void (*atari_treeview_mouse_action_callback)(struct core_window *cw,
|
|
|
|
browser_mouse_state mouse,
|
|
|
|
int x, int y);
|
|
|
|
typedef void (*atari_treeview_draw_callback)(struct core_window *cw, int x,
|
2013-09-21 07:29:04 +04:00
|
|
|
int y, struct rect *clip,
|
2013-09-17 04:10:35 +04:00
|
|
|
const struct redraw_context *ctx);
|
|
|
|
|
2013-09-16 04:26:43 +04:00
|
|
|
struct atari_treeview_callbacks {
|
2013-09-21 07:29:04 +04:00
|
|
|
atari_treeview_init2_callback init_phase2;
|
|
|
|
atari_treeview_finish_callback finish;
|
2013-09-17 04:10:35 +04:00
|
|
|
atari_treeview_draw_callback draw;
|
|
|
|
atari_treeview_keypress_callback keypress;
|
|
|
|
atari_treeview_mouse_action_callback mouse_action;
|
2013-09-16 04:26:43 +04:00
|
|
|
gemtk_wm_event_handler_f gemtk_user_func;
|
2012-11-22 03:10:55 +04:00
|
|
|
};
|
|
|
|
|
2013-09-26 03:24:49 +04:00
|
|
|
/**
|
|
|
|
* Initalize an window to be an treeview window.
|
|
|
|
*
|
|
|
|
*/
|
2013-09-22 05:10:12 +04:00
|
|
|
struct core_window *atari_treeview_create(GUIWIN *win,
|
2013-09-21 22:20:49 +04:00
|
|
|
struct atari_treeview_callbacks * callbacks,
|
|
|
|
void * user_data, uint32_t flags);
|
2013-09-26 03:24:49 +04:00
|
|
|
/**
|
|
|
|
* Free the Treeview, but not the gemtk window used for the treeview.
|
|
|
|
*/
|
2013-09-22 05:10:12 +04:00
|
|
|
void atari_treeview_delete(struct core_window *cw);
|
2013-09-26 03:24:49 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Open the treeview window.
|
|
|
|
*/
|
2013-09-22 05:10:12 +04:00
|
|
|
void atari_treeview_open(struct core_window *cw, GRECT *pos);
|
2013-09-26 03:24:49 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the window "open" state.
|
|
|
|
*/
|
2013-09-22 05:10:12 +04:00
|
|
|
bool atari_treeview_is_open(struct core_window *cw);
|
2013-09-26 03:24:49 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Closes (hides) the treeview window.
|
|
|
|
*/
|
2013-09-22 05:10:12 +04:00
|
|
|
void atari_treeview_close(struct core_window *cw);
|
2013-09-26 03:24:49 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the window manager window handle
|
|
|
|
*/
|
|
|
|
|
2013-09-22 05:10:12 +04:00
|
|
|
GUIWIN * atari_treeview_get_gemtk_window(struct core_window *cw);
|
2013-09-26 03:24:49 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get an specific area inside the window.
|
|
|
|
*/
|
2013-09-22 05:10:12 +04:00
|
|
|
void atari_treeview_get_grect(struct core_window *cw, enum treeview_area_e mode,
|
2013-09-21 07:29:04 +04:00
|
|
|
GRECT *dest);
|
2013-09-26 03:24:49 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Process all pending redraw requests for a single treeview
|
|
|
|
*/
|
2013-09-22 05:10:12 +04:00
|
|
|
void atari_treeview_redraw(struct core_window *cw);
|
2013-09-26 03:24:49 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Attach arbitary user data to the treeview.
|
|
|
|
*/
|
2013-09-22 05:10:12 +04:00
|
|
|
void atari_treeview_set_user_data(struct core_window *cw,
|
2013-09-21 22:20:49 +04:00
|
|
|
void *user_data_ptr);
|
2013-09-26 03:24:49 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the arbitary user data set by atari_treeview_set_user_data()
|
|
|
|
*/
|
2013-09-22 05:10:12 +04:00
|
|
|
void *atari_treeview_get_user_data(struct core_window *cw);
|
2013-09-26 03:24:49 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Process all redraw request of all open Treeview windows
|
|
|
|
*/
|
2013-09-21 22:20:49 +04:00
|
|
|
void atari_treeview_flush_redraws(void);
|
2013-09-26 03:24:49 +04:00
|
|
|
|
2013-09-16 04:26:43 +04:00
|
|
|
#endif //NSATARI_TREEVIEW_H
|
2012-11-22 03:10:55 +04:00
|
|
|
|