Remove obsolete UI_DIALOG constructor, macros

This commit is contained in:
Kp 2020-09-21 03:18:12 +00:00
parent a069daae41
commit d056daa162
3 changed files with 12 additions and 21 deletions

View file

@ -233,11 +233,7 @@ public:
// For creating the dialog, there are two ways - using the (older) ui_create_dialog function
// or using the constructor, passing an event handler that takes a subclass of UI_DIALOG.
explicit UI_DIALOG(short x, short y, short w, short h, enum dialog_flags flags, ui_subfunction_t<void> callback, void *userdata, const void *createdata);
template <typename T>
UI_DIALOG(short x, short y, short w, short h, enum dialog_flags flags, ui_subclass_subfunction_t<T> callback) :
UI_DIALOG(x, y, w, h, flags, reinterpret_cast<ui_subclass_subfunction_t<UI_DIALOG>>(callback), nullptr, nullptr) {}
~UI_DIALOG();
};

View file

@ -41,18 +41,13 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
namespace dcx {
#define D_X (dlg->d_x)
#define D_Y (dlg->d_y)
#define D_WIDTH (dlg->d_width)
#define D_HEIGHT (dlg->d_height)
static void ui_dialog_draw(UI_DIALOG *dlg)
{
int w, h;
int req_w, req_h;
w = D_WIDTH;
h = D_HEIGHT;
w = dlg->d_width;
h = dlg->d_height;
req_w = w;
req_h = h;
@ -130,10 +125,10 @@ d_callback(callback), gadget(nullptr), keyboard_focus_gadget(nullptr), d_userdat
if ( y < 0 ) y = 0;
if ( (y+h-1) >= sh ) y = sh - h;
D_X = x;
D_Y = y;
D_WIDTH = w;
D_HEIGHT = h;
d_x = x;
d_y = y;
d_width = w;
d_height = h;
selected_gadget = NULL;
dlg->wind = window_create(grd_curscreen->sc_canvas,

View file

@ -64,6 +64,8 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
//-------------------------------------------------------------------------
static UI_DIALOG *MainWindow = NULL;
namespace dsx {
namespace {
struct centers_dialog
@ -81,7 +83,6 @@ static window_event_result centers_dialog_handler(UI_DIALOG *dlg,const d_event &
//-------------------------------------------------------------------------
// Called from the editor... does one instance of the centers dialog box
//-------------------------------------------------------------------------
namespace dsx {
int do_centers_dialog()
{
// Only open 1 instance of this window...
@ -105,9 +106,7 @@ int do_centers_dialog()
MainWindow = ui_create_dialog(x, TMAPBOX_Y+20, width, 545-TMAPBOX_Y, DF_DIALOG, centers_dialog_handler, std::move(c));
return 1;
}
}
namespace dsx {
static window_event_result centers_dialog_created(UI_DIALOG *const w, centers_dialog *const c)
{
#if defined(DXX_BUILD_DESCENT_I)
@ -148,6 +147,8 @@ void close_centers_window()
}
}
namespace dsx {
window_event_result centers_dialog_handler(UI_DIALOG *dlg,const d_event &event, centers_dialog *c)
{
auto &RobotCenters = LevelSharedRobotcenterState.RobotCenters;
@ -254,5 +255,4 @@ window_event_result centers_dialog_handler(UI_DIALOG *dlg,const d_event &event,
return rval;
}
}