2006-03-20 17:12:09 +00:00
|
|
|
/*
|
2014-06-01 17:55:23 +00:00
|
|
|
* Portions of this file are copyright Rebirth contributors and licensed as
|
|
|
|
* described in COPYING.txt.
|
|
|
|
* Portions of this file are copyright Parallax Software and licensed
|
|
|
|
* according to the Parallax license below.
|
|
|
|
* See COPYING.txt for license details.
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
|
|
|
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
|
|
|
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
|
|
|
|
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
|
|
|
|
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
|
|
|
|
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
|
|
|
|
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
|
|
|
|
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
|
2013-02-24 02:40:43 +00:00
|
|
|
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
|
2006-03-20 17:12:09 +00:00
|
|
|
COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|
|
|
*/
|
|
|
|
|
2010-12-24 04:34:30 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Header file for user interface
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-04-02 02:36:54 +00:00
|
|
|
#pragma once
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2017-06-25 20:46:03 +00:00
|
|
|
#include <type_traits>
|
2013-06-27 02:35:22 +00:00
|
|
|
#include "dxxsconf.h"
|
2016-03-19 19:08:10 +00:00
|
|
|
#include "dsx-ns.h"
|
2015-10-09 02:46:10 +00:00
|
|
|
#include "fwd-event.h"
|
2013-12-08 23:37:40 +00:00
|
|
|
#include "fmtcheck.h"
|
2014-08-27 03:15:06 +00:00
|
|
|
#include "u_mem.h"
|
2011-01-14 09:51:13 +00:00
|
|
|
|
2012-11-17 06:14:09 +00:00
|
|
|
#ifdef __cplusplus
|
2015-01-29 04:27:35 +00:00
|
|
|
#include <cstdint>
|
2014-12-05 02:09:05 +00:00
|
|
|
#include <string>
|
2015-11-26 02:56:55 +00:00
|
|
|
#include "fwd-gr.h"
|
2013-12-04 23:31:29 +00:00
|
|
|
#include "varutil.h"
|
2014-08-06 02:10:49 +00:00
|
|
|
#include "window.h"
|
2014-12-22 04:35:48 +00:00
|
|
|
#include "ntstring.h"
|
2020-05-02 21:18:42 +00:00
|
|
|
#include <array>
|
2020-05-02 21:18:43 +00:00
|
|
|
#include <memory>
|
2012-11-17 06:14:09 +00:00
|
|
|
|
2015-12-13 18:00:49 +00:00
|
|
|
namespace dcx {
|
2015-12-05 22:57:24 +00:00
|
|
|
|
2020-10-12 03:28:26 +00:00
|
|
|
struct UI_DIALOG;
|
|
|
|
|
2013-12-22 22:03:07 +00:00
|
|
|
struct UI_KEYPAD {
|
2020-05-02 21:18:42 +00:00
|
|
|
using buttontext_element_t = std::array<char, 100>;
|
|
|
|
using buttontext_t = std::array<buttontext_element_t, 17>;
|
2014-12-20 04:36:10 +00:00
|
|
|
UI_KEYPAD();
|
2014-12-20 04:36:08 +00:00
|
|
|
unsigned numkeys;
|
2014-12-22 04:35:48 +00:00
|
|
|
ntstring<99> description;
|
2020-05-02 21:18:42 +00:00
|
|
|
std::array<short, 100> keycode;
|
|
|
|
std::array<int, 100> function_number;
|
2014-12-20 04:36:08 +00:00
|
|
|
buttontext_t buttontext;
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2013-12-22 22:03:07 +00:00
|
|
|
struct UI_EVENT
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
unsigned int frame;
|
|
|
|
int type;
|
|
|
|
int data;
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2014-09-06 23:27:57 +00:00
|
|
|
struct UI_GADGET
|
|
|
|
{
|
2020-10-12 03:28:26 +00:00
|
|
|
virtual window_event_result event_handler(UI_DIALOG &dlg, const d_event &) = 0;
|
2015-04-02 02:36:54 +00:00
|
|
|
uint8_t kind;
|
2015-04-02 02:36:54 +00:00
|
|
|
short x1,y1,x2,y2;
|
|
|
|
int hotkey;
|
2013-12-22 22:03:07 +00:00
|
|
|
struct UI_GADGET * prev; \
|
|
|
|
struct UI_GADGET * next; \
|
|
|
|
struct UI_GADGET * when_tab; \
|
|
|
|
struct UI_GADGET * when_btab; \
|
|
|
|
struct UI_GADGET * when_up; \
|
|
|
|
struct UI_GADGET * when_down; \
|
|
|
|
struct UI_GADGET * when_left; \
|
|
|
|
struct UI_GADGET * when_right; \
|
|
|
|
struct UI_GADGET * parent; \
|
2014-09-06 23:55:43 +00:00
|
|
|
grs_subcanvas_ptr canvas; \
|
2016-08-06 19:55:23 +00:00
|
|
|
protected:
|
|
|
|
~UI_GADGET() = default;
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2020-11-30 05:12:00 +00:00
|
|
|
struct UI_GADGET_USERBOX final : UI_GADGET
|
2014-09-06 23:27:57 +00:00
|
|
|
{
|
2017-06-25 20:46:03 +00:00
|
|
|
static constexpr auto s_kind = std::integral_constant<uint8_t, 7>{};
|
2020-10-12 03:28:26 +00:00
|
|
|
virtual window_event_result event_handler(UI_DIALOG &dlg, const d_event &event) override;
|
2006-03-20 17:12:09 +00:00
|
|
|
short width, height;
|
|
|
|
short b1_held_down;
|
|
|
|
short b1_clicked;
|
|
|
|
short b1_double_clicked;
|
|
|
|
short b1_dragging;
|
|
|
|
short b1_drag_x1, b1_drag_y1;
|
|
|
|
short b1_drag_x2, b1_drag_y2;
|
|
|
|
short b1_done_dragging;
|
|
|
|
short mouse_onme;
|
|
|
|
short mouse_x, mouse_y;
|
2015-04-02 02:36:54 +00:00
|
|
|
int keypress;
|
2006-03-20 17:12:09 +00:00
|
|
|
grs_bitmap * bitmap;
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2020-11-30 05:12:00 +00:00
|
|
|
struct UI_GADGET_BUTTON final : UI_GADGET
|
2014-09-06 23:27:57 +00:00
|
|
|
{
|
2017-06-25 20:46:03 +00:00
|
|
|
static constexpr auto s_kind = std::integral_constant<uint8_t, 1>{};
|
2020-10-12 03:28:26 +00:00
|
|
|
virtual window_event_result event_handler(UI_DIALOG &dlg, const d_event &event) override;
|
2014-09-07 21:21:57 +00:00
|
|
|
std::string text;
|
2014-09-06 23:27:57 +00:00
|
|
|
short width, height;
|
2006-03-20 17:12:09 +00:00
|
|
|
short position;
|
|
|
|
short oldposition;
|
|
|
|
short pressed;
|
2015-04-02 02:36:54 +00:00
|
|
|
uint8_t dim_if_no_function;
|
|
|
|
int hotkey1;
|
2006-03-20 17:12:09 +00:00
|
|
|
int (*user_function)(void);
|
|
|
|
int (*user_function1)(void);
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2020-11-30 05:12:00 +00:00
|
|
|
struct UI_GADGET_INPUTBOX final : UI_GADGET
|
2014-09-06 23:27:57 +00:00
|
|
|
{
|
2017-06-25 20:46:03 +00:00
|
|
|
static constexpr auto s_kind = std::integral_constant<uint8_t, 6>{};
|
2020-10-12 03:28:26 +00:00
|
|
|
virtual window_event_result event_handler(UI_DIALOG &dlg, const d_event &event) override;
|
2020-09-28 03:32:15 +00:00
|
|
|
std::unique_ptr<char[]> text;
|
2014-09-06 23:27:57 +00:00
|
|
|
short width, height;
|
2006-03-20 17:12:09 +00:00
|
|
|
short length;
|
|
|
|
short position;
|
|
|
|
short oldposition;
|
|
|
|
short pressed;
|
|
|
|
short first_time;
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2020-11-30 05:12:00 +00:00
|
|
|
struct UI_GADGET_RADIO final : UI_GADGET
|
2014-09-06 23:27:57 +00:00
|
|
|
{
|
2017-06-25 20:46:03 +00:00
|
|
|
static constexpr auto s_kind = std::integral_constant<uint8_t, 4>{};
|
2020-10-12 03:28:26 +00:00
|
|
|
virtual window_event_result event_handler(UI_DIALOG &dlg, const d_event &event) override;
|
2015-01-28 03:42:53 +00:00
|
|
|
RAIIdmem<char[]> text;
|
2014-09-06 23:27:57 +00:00
|
|
|
short width, height;
|
2006-03-20 17:12:09 +00:00
|
|
|
short position;
|
|
|
|
short oldposition;
|
|
|
|
short pressed;
|
|
|
|
short group;
|
|
|
|
short flag;
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2020-11-30 05:12:00 +00:00
|
|
|
struct UI_GADGET_ICON final : UI_GADGET
|
2014-09-06 23:27:57 +00:00
|
|
|
{
|
2017-06-25 20:46:03 +00:00
|
|
|
static constexpr auto s_kind = std::integral_constant<uint8_t, 9>{};
|
2020-10-12 03:28:26 +00:00
|
|
|
virtual window_event_result event_handler(UI_DIALOG &dlg, const d_event &event) override;
|
2015-01-28 03:42:53 +00:00
|
|
|
RAIIdmem<char[]> text;
|
2006-03-20 17:12:09 +00:00
|
|
|
short width, height;
|
|
|
|
sbyte flag;
|
|
|
|
sbyte pressed;
|
|
|
|
sbyte position;
|
|
|
|
sbyte oldposition;
|
|
|
|
int trap_key;
|
|
|
|
int (*user_function)(void);
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2020-11-30 05:12:00 +00:00
|
|
|
struct UI_GADGET_CHECKBOX final : UI_GADGET
|
2014-09-06 23:27:57 +00:00
|
|
|
{
|
2017-06-25 20:46:03 +00:00
|
|
|
static constexpr auto s_kind = std::integral_constant<uint8_t, 5>{};
|
2020-10-12 03:28:26 +00:00
|
|
|
virtual window_event_result event_handler(UI_DIALOG &dlg, const d_event &event) override;
|
2015-01-28 03:42:53 +00:00
|
|
|
RAIIdmem<char[]> text;
|
2014-09-06 23:27:57 +00:00
|
|
|
short width, height;
|
2006-03-20 17:12:09 +00:00
|
|
|
short position;
|
|
|
|
short oldposition;
|
|
|
|
short pressed;
|
|
|
|
short group;
|
|
|
|
short flag;
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2020-11-30 05:12:00 +00:00
|
|
|
struct UI_GADGET_SCROLLBAR final : UI_GADGET
|
2014-09-06 23:27:57 +00:00
|
|
|
{
|
2017-06-25 20:46:03 +00:00
|
|
|
static constexpr auto s_kind = std::integral_constant<uint8_t, 3>{};
|
2020-10-12 03:28:26 +00:00
|
|
|
virtual window_event_result event_handler(UI_DIALOG &dlg, const d_event &event) override;
|
2006-03-20 17:12:09 +00:00
|
|
|
short horz;
|
|
|
|
short width, height;
|
|
|
|
int start;
|
|
|
|
int stop;
|
|
|
|
int position;
|
|
|
|
int window_size;
|
|
|
|
int fake_length;
|
|
|
|
int fake_position;
|
|
|
|
int fake_size;
|
2014-12-20 04:36:10 +00:00
|
|
|
std::unique_ptr<UI_GADGET_BUTTON> up_button, down_button;
|
2010-12-10 23:18:17 +00:00
|
|
|
fix64 last_scrolled;
|
2006-03-20 17:12:09 +00:00
|
|
|
short drag_x, drag_y;
|
|
|
|
int drag_starting;
|
|
|
|
int dragging;
|
|
|
|
int moved;
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2020-11-30 05:12:00 +00:00
|
|
|
struct UI_GADGET_LISTBOX final : UI_GADGET
|
2014-09-06 23:27:57 +00:00
|
|
|
{
|
2017-06-25 20:46:03 +00:00
|
|
|
static constexpr auto s_kind = std::integral_constant<uint8_t, 2>{};
|
2020-10-12 03:28:26 +00:00
|
|
|
virtual window_event_result event_handler(UI_DIALOG &dlg, const d_event &event) override;
|
2015-04-02 02:36:54 +00:00
|
|
|
const char *const *list;
|
2014-09-06 23:27:57 +00:00
|
|
|
short width, height;
|
2006-03-20 17:12:09 +00:00
|
|
|
int num_items;
|
|
|
|
int num_items_displayed;
|
|
|
|
int first_item;
|
|
|
|
int old_first_item;
|
|
|
|
int current_item;
|
|
|
|
int selected_item;
|
|
|
|
int old_current_item;
|
|
|
|
int dragging;
|
|
|
|
int textheight;
|
|
|
|
int moved;
|
2014-12-20 04:36:10 +00:00
|
|
|
std::unique_ptr<UI_GADGET_SCROLLBAR> scrollbar;
|
|
|
|
fix64 last_scrolled;
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2011-10-09 10:32:53 +00:00
|
|
|
enum dialog_flags
|
|
|
|
{
|
|
|
|
DF_FILLED = 2,
|
|
|
|
DF_SAVE_BG = 4,
|
|
|
|
DF_DIALOG = (4+2+1),
|
|
|
|
DF_MODAL = 8 // modal = accept all user input exclusively
|
|
|
|
};
|
|
|
|
|
2016-10-04 03:29:19 +00:00
|
|
|
template <typename T>
|
2016-10-04 07:58:20 +00:00
|
|
|
using ui_subfunction_t = window_event_result (*)(struct UI_DIALOG *,const d_event &, T *);
|
2016-10-04 03:29:19 +00:00
|
|
|
|
2020-09-21 03:18:12 +00:00
|
|
|
struct UI_DIALOG : window
|
2013-12-22 22:03:07 +00:00
|
|
|
{
|
2016-10-04 03:29:19 +00:00
|
|
|
// TODO: Make these private
|
2020-09-21 03:18:12 +00:00
|
|
|
UI_GADGET *gadget = nullptr;
|
|
|
|
UI_GADGET *keyboard_focus_gadget = nullptr;
|
2016-10-04 03:29:19 +00:00
|
|
|
short d_width, d_height;
|
|
|
|
enum dialog_flags d_flags;
|
|
|
|
|
|
|
|
public:
|
2020-12-19 16:13:26 +00:00
|
|
|
explicit UI_DIALOG(short x, short y, short w, short h, enum dialog_flags flags);
|
2020-09-21 03:18:12 +00:00
|
|
|
|
2016-10-04 08:09:21 +00:00
|
|
|
~UI_DIALOG();
|
2020-09-21 03:18:12 +00:00
|
|
|
virtual window_event_result event_handler(const d_event &) override;
|
2020-12-19 16:13:26 +00:00
|
|
|
virtual window_event_result callback_handler(const d_event &) = 0;
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2014-10-04 21:47:13 +00:00
|
|
|
#define B1_JUST_PRESSED (event.type == EVENT_MOUSE_BUTTON_DOWN && event_mouse_get_button(event) == 0)
|
|
|
|
#define B1_JUST_RELEASED (event.type == EVENT_MOUSE_BUTTON_UP && event_mouse_get_button(event) == 0)
|
|
|
|
#define B1_DOUBLE_CLICKED (event.type == EVENT_MOUSE_DOUBLE_CLICKED && event_mouse_get_button(event) == 0)
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2014-07-20 03:48:27 +00:00
|
|
|
extern grs_font_ptr ui_small_font;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
extern unsigned char CBLACK,CGREY,CWHITE,CBRIGHT,CRED;
|
|
|
|
extern UI_GADGET * selected_gadget;
|
|
|
|
|
2017-02-11 21:42:35 +00:00
|
|
|
#define Hline(C,x1,x2,y,c) Hline(C,x1,y,x2,c)
|
2017-02-11 21:42:35 +00:00
|
|
|
#define Vline(C,y1,y2,x,c) Vline(C,x,y1,y2,c)
|
2020-07-16 02:31:04 +00:00
|
|
|
void Hline(grs_canvas &, fix x1, fix x2, fix y, color_palette_index color);
|
|
|
|
void Vline(grs_canvas &, fix y1, fix y2, fix x, color_palette_index color);
|
2017-02-11 21:42:36 +00:00
|
|
|
void ui_string_centered(grs_canvas &, unsigned x, unsigned y, const char *s);
|
2017-02-11 21:42:35 +00:00
|
|
|
void ui_draw_box_out(grs_canvas &, unsigned x1, unsigned y1, unsigned x2, unsigned y2);
|
2017-02-11 21:42:36 +00:00
|
|
|
void ui_draw_box_in(grs_canvas &, unsigned x1, unsigned y1, unsigned x2, unsigned y2);
|
2020-07-16 02:31:04 +00:00
|
|
|
void ui_draw_shad(grs_canvas &, unsigned x1, unsigned y1, unsigned x2, unsigned y2, color_palette_index c1, color_palette_index c2);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2016-11-10 11:23:40 +00:00
|
|
|
int ui_init();
|
2006-03-20 17:12:09 +00:00
|
|
|
void ui_close();
|
2013-12-04 23:31:29 +00:00
|
|
|
|
|
|
|
typedef cstring_tie<10> ui_messagebox_tie;
|
|
|
|
int ui_messagebox( short xc, short yc, const char * text, const ui_messagebox_tie &Button );
|
|
|
|
#define ui_messagebox(X,Y,N,T,...) ((ui_messagebox)((X),(Y),(T), ui_messagebox_tie(__VA_ARGS__)))
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2013-12-04 22:37:23 +00:00
|
|
|
class unused_ui_userdata_t;
|
2016-08-06 19:55:24 +00:00
|
|
|
constexpr unused_ui_userdata_t *unused_ui_userdata = nullptr;
|
2013-12-04 22:37:23 +00:00
|
|
|
|
2020-10-12 03:28:26 +00:00
|
|
|
void ui_dialog_set_current_canvas(UI_DIALOG &dlg);
|
2020-10-12 03:28:26 +00:00
|
|
|
void ui_close_dialog(UI_DIALOG &dlg);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2020-10-12 03:28:25 +00:00
|
|
|
#define GADGET_PRESSED(g) (event.type == EVENT_UI_GADGET_PRESSED && &ui_event_get_gadget(event) == g)
|
2012-03-05 11:08:41 +00:00
|
|
|
|
2020-10-12 03:28:25 +00:00
|
|
|
void ui_gadget_add(UI_DIALOG &dlg, short x1, short y1, short x2, short y2, UI_GADGET &);
|
2021-06-28 03:37:51 +00:00
|
|
|
|
2014-09-06 23:27:57 +00:00
|
|
|
template <typename T>
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2020-10-12 03:28:25 +00:00
|
|
|
static std::unique_ptr<T> ui_gadget_add(UI_DIALOG &dlg, short x1, short y1, short x2, short y2)
|
2014-09-06 23:27:57 +00:00
|
|
|
{
|
2020-05-02 21:18:42 +00:00
|
|
|
auto t = std::make_unique<T>();
|
2014-09-06 23:27:57 +00:00
|
|
|
t->kind = T::s_kind;
|
2020-10-12 03:28:25 +00:00
|
|
|
ui_gadget_add(dlg, x1, y1, x2, y2, *t);
|
2014-09-06 23:27:57 +00:00
|
|
|
return t;
|
|
|
|
}
|
2021-06-28 03:37:51 +00:00
|
|
|
|
|
|
|
[[nodiscard]]
|
2020-10-12 03:28:26 +00:00
|
|
|
std::unique_ptr<UI_GADGET_BUTTON> ui_add_gadget_button(UI_DIALOG &dlg, short x, short y, short w, short h, const char *text, int (*function_to_call)());
|
2021-06-28 03:37:51 +00:00
|
|
|
|
2020-10-12 03:28:25 +00:00
|
|
|
window_event_result ui_gadget_send_event(UI_DIALOG &dlg, enum event_type type, UI_GADGET &gadget);
|
|
|
|
UI_GADGET &ui_event_get_gadget(const d_event &event);
|
2020-10-12 03:28:25 +00:00
|
|
|
window_event_result ui_dialog_do_gadgets(UI_DIALOG &dlg, const d_event &event);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2020-10-12 03:28:26 +00:00
|
|
|
int ui_mouse_on_gadget(UI_GADGET &gadget);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2020-10-12 03:28:25 +00:00
|
|
|
std::unique_ptr<UI_GADGET_LISTBOX> ui_add_gadget_listbox(UI_DIALOG &dlg, short x, short y, short w, short h, short numitems, char **list);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
extern void ui_mega_process();
|
|
|
|
|
2021-09-12 16:20:52 +00:00
|
|
|
gr_string_size ui_get_button_size(const grs_font &, const char *text);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2020-10-12 03:28:26 +00:00
|
|
|
std::unique_ptr<UI_GADGET_SCROLLBAR> ui_add_gadget_scrollbar(UI_DIALOG &dlg, short x, short y, short w, short h, int start, int stop, int position, int window_size);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2013-12-08 23:37:40 +00:00
|
|
|
void ui_dputs_at( UI_DIALOG * dlg, short x, short y, const char * str );
|
2013-06-27 02:35:22 +00:00
|
|
|
extern void ui_dprintf_at( UI_DIALOG * dlg, short x, short y, const char * format, ... ) __attribute_format_printf(4, 5);
|
2013-12-08 23:37:40 +00:00
|
|
|
#define ui_dprintf_at(A1,A2,A3,F,...) dxx_call_printf_checked(ui_dprintf_at,ui_dputs_at,(A1,A2,A3),(F),##__VA_ARGS__)
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2020-10-12 03:28:26 +00:00
|
|
|
std::unique_ptr<UI_GADGET_RADIO> ui_add_gadget_radio(UI_DIALOG &dlg, short x, short y, short w, short h, short group, const char *text);
|
2021-06-28 03:37:51 +00:00
|
|
|
|
2020-10-12 03:28:26 +00:00
|
|
|
void ui_radio_set_value(UI_GADGET_RADIO &radio, int value);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2020-10-12 03:28:26 +00:00
|
|
|
std::unique_ptr<UI_GADGET_CHECKBOX> ui_add_gadget_checkbox(UI_DIALOG &dlg, short x, short y, short w, short h, short group, const char *text);
|
2021-06-28 03:37:51 +00:00
|
|
|
|
2010-12-24 04:34:30 +00:00
|
|
|
extern void ui_checkbox_check(UI_GADGET_CHECKBOX * checkbox, int check);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2020-10-12 03:28:26 +00:00
|
|
|
UI_GADGET &ui_gadget_get_next(UI_GADGET &gadget);
|
2020-10-12 03:28:26 +00:00
|
|
|
void ui_gadget_calc_keys(UI_DIALOG &dlg);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2015-04-02 02:36:54 +00:00
|
|
|
void ui_listbox_change(UI_DIALOG *dlg, UI_GADGET_LISTBOX *listbox, uint_fast32_t numitems, const char *const *list);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2020-10-12 03:28:26 +00:00
|
|
|
std::unique_ptr<UI_GADGET_INPUTBOX> ui_add_gadget_inputbox(UI_DIALOG &dlg, short x, short y, uint_fast32_t length_of_initial_text, uint_fast32_t maximum_allowed_text_length, const char *text);
|
2014-12-20 04:36:09 +00:00
|
|
|
|
|
|
|
template <std::size_t SL, std::size_t L>
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2020-10-12 03:28:26 +00:00
|
|
|
static inline std::unique_ptr<UI_GADGET_INPUTBOX> ui_add_gadget_inputbox(UI_DIALOG &dlg, short x, short y, const char (&text)[L])
|
2014-12-20 04:36:09 +00:00
|
|
|
{
|
|
|
|
static_assert(SL <= L, "SL too large");
|
|
|
|
return ui_add_gadget_inputbox(dlg, x, y, L, SL, text);
|
|
|
|
}
|
|
|
|
|
2013-06-08 22:24:17 +00:00
|
|
|
extern void ui_inputbox_set_text(UI_GADGET_INPUTBOX *inputbox, const char *text);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2020-10-12 03:28:26 +00:00
|
|
|
std::unique_ptr<UI_GADGET_USERBOX> ui_add_gadget_userbox(UI_DIALOG &dlg, short x, short y, short w, short h);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2013-09-02 23:21:13 +00:00
|
|
|
int MenuX( int x, int y, int NumButtons, const char *const text[] );
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2020-10-12 03:28:25 +00:00
|
|
|
#if DXX_USE_EDITOR
|
2020-10-12 03:28:25 +00:00
|
|
|
int ui_get_filename(std::array<char, PATH_MAX> &filename, const char *filespec, const char *message);
|
2020-10-12 03:28:25 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
void * ui_malloc( int size );
|
|
|
|
void ui_free( void * buffer );
|
|
|
|
|
|
|
|
#define UI_RECORD_MOUSE 1
|
|
|
|
#define UI_RECORD_KEYS 2
|
|
|
|
#define UI_STATUS_NORMAL 0
|
|
|
|
#define UI_STATUS_RECORDING 1
|
|
|
|
#define UI_STATUS_PLAYING 2
|
|
|
|
#define UI_STATUS_FASTPLAY 3
|
|
|
|
|
2013-06-08 22:24:17 +00:00
|
|
|
int ui_get_file( char * filename, const char * Filespec );
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2020-10-12 03:28:26 +00:00
|
|
|
std::unique_ptr<UI_GADGET_ICON> ui_add_gadget_icon(UI_DIALOG &dlg, const char *text, short x, short y, short w, short h, int k,int (*f)());
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2013-06-08 22:24:17 +00:00
|
|
|
int DecodeKeyText( const char * text );
|
2015-01-29 04:27:35 +00:00
|
|
|
void GetKeyDescription(char (&text)[100], uint_fast32_t keypress);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2017-09-26 04:15:50 +00:00
|
|
|
int menubar_init(grs_canvas &canvas, const char * filename );
|
2006-03-20 17:12:09 +00:00
|
|
|
extern void menubar_close();
|
|
|
|
extern void menubar_hide();
|
|
|
|
extern void menubar_show();
|
|
|
|
|
|
|
|
void ui_pad_init();
|
|
|
|
void ui_pad_close();
|
2015-01-29 04:27:35 +00:00
|
|
|
void ui_pad_activate(UI_DIALOG &dlg, uint_fast32_t x, uint_fast32_t y);
|
2006-03-20 17:12:09 +00:00
|
|
|
void ui_pad_deactivate();
|
|
|
|
void ui_pad_goto(int n);
|
|
|
|
void ui_pad_goto_next();
|
|
|
|
void ui_pad_goto_prev();
|
2016-11-10 11:23:40 +00:00
|
|
|
int ui_pad_read( int n, const char * filename );
|
2006-03-20 17:12:09 +00:00
|
|
|
int ui_pad_get_current();
|
2012-04-09 02:14:10 +00:00
|
|
|
void ui_pad_draw(UI_DIALOG *dlg, int x, int y);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2013-06-08 22:24:17 +00:00
|
|
|
void ui_barbox_open( const char * text, int length );
|
2006-03-20 17:12:09 +00:00
|
|
|
void ui_barbox_update( int position );
|
|
|
|
void ui_barbox_close();
|
|
|
|
|
|
|
|
extern int ui_button_any_drawn;
|
|
|
|
|
2015-12-05 22:57:24 +00:00
|
|
|
}
|
|
|
|
|
2012-11-17 06:14:09 +00:00
|
|
|
#endif
|