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
|
|
|
|
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
|
|
|
|
COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|
|
|
*/
|
|
|
|
|
2014-09-06 23:27:57 +00:00
|
|
|
#include <stdexcept>
|
2006-03-20 17:12:09 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "u_mem.h"
|
2012-07-01 02:54:33 +00:00
|
|
|
#include "maths.h"
|
2006-03-20 17:12:09 +00:00
|
|
|
#include "pstypes.h"
|
|
|
|
#include "gr.h"
|
|
|
|
#include "ui.h"
|
2011-10-23 09:08:47 +00:00
|
|
|
#include "event.h"
|
2011-10-25 01:39:35 +00:00
|
|
|
#include "mouse.h"
|
2011-12-18 12:41:31 +00:00
|
|
|
#include "window.h"
|
2012-07-07 18:35:06 +00:00
|
|
|
#include "dxxerror.h"
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
#include "key.h"
|
|
|
|
|
2015-12-13 18:00:49 +00:00
|
|
|
namespace dcx {
|
2015-12-05 22:57:24 +00:00
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
UI_GADGET * selected_gadget;
|
|
|
|
|
2015-06-11 03:06:58 +00:00
|
|
|
constexpr tt::integral_constant<uint8_t, 1> UI_GADGET_BUTTON::s_kind;
|
|
|
|
constexpr tt::integral_constant<uint8_t, 2> UI_GADGET_LISTBOX::s_kind;
|
|
|
|
constexpr tt::integral_constant<uint8_t, 3> UI_GADGET_SCROLLBAR::s_kind;
|
|
|
|
constexpr tt::integral_constant<uint8_t, 4> UI_GADGET_RADIO::s_kind;
|
|
|
|
constexpr tt::integral_constant<uint8_t, 5> UI_GADGET_CHECKBOX::s_kind;
|
|
|
|
constexpr tt::integral_constant<uint8_t, 6> UI_GADGET_INPUTBOX::s_kind;
|
|
|
|
constexpr tt::integral_constant<uint8_t, 7> UI_GADGET_USERBOX::s_kind;
|
|
|
|
constexpr tt::integral_constant<uint8_t, 9> UI_GADGET_ICON::s_kind;
|
|
|
|
|
2015-08-12 03:11:46 +00:00
|
|
|
namespace {
|
|
|
|
|
2014-10-04 18:05:26 +00:00
|
|
|
struct event_gadget : d_event
|
2012-03-03 12:19:15 +00:00
|
|
|
{
|
|
|
|
UI_GADGET *gadget;
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2012-03-03 12:19:15 +00:00
|
|
|
|
2015-08-12 03:11:46 +00:00
|
|
|
}
|
|
|
|
|
2014-09-06 23:27:57 +00:00
|
|
|
void ui_gadget_add(UI_DIALOG * dlg, short x1, short y1, short x2, short y2, UI_GADGET *gadget)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2011-01-17 14:42:18 +00:00
|
|
|
if (dlg->gadget == NULL )
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2011-01-17 14:42:18 +00:00
|
|
|
dlg->gadget = gadget;
|
2006-03-20 17:12:09 +00:00
|
|
|
gadget->prev = gadget;
|
|
|
|
gadget->next = gadget;
|
|
|
|
} else {
|
2011-01-17 14:42:18 +00:00
|
|
|
dlg->gadget->prev->next = gadget;
|
|
|
|
gadget->next = dlg->gadget;
|
|
|
|
gadget->prev = dlg->gadget->prev;
|
|
|
|
dlg->gadget->prev = gadget;
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gadget->when_tab = NULL;
|
|
|
|
gadget->when_btab = NULL;
|
|
|
|
gadget->when_up = NULL;
|
|
|
|
gadget->when_down = NULL;
|
|
|
|
gadget->when_left = NULL;
|
|
|
|
gadget->when_right = NULL;
|
|
|
|
gadget->status = 1;
|
|
|
|
gadget->oldstatus = 0;
|
|
|
|
if ( x1==0 && x2==0 && y1==0 && y2== 0 )
|
2014-09-06 23:55:43 +00:00
|
|
|
gadget->canvas.reset();
|
2006-03-20 17:12:09 +00:00
|
|
|
else
|
2015-01-17 18:31:40 +00:00
|
|
|
gadget->canvas = gr_create_sub_canvas(window_get_canvas(*ui_dialog_get_window(dlg)), x1, y1, x2-x1+1, y2-y1+1);
|
2006-03-20 17:12:09 +00:00
|
|
|
gadget->x1 = gadget->canvas->cv_bitmap.bm_x;
|
|
|
|
gadget->y1 = gadget->canvas->cv_bitmap.bm_y;
|
|
|
|
gadget->x2 = gadget->canvas->cv_bitmap.bm_x+x2-x1+1;
|
|
|
|
gadget->y2 = gadget->canvas->cv_bitmap.bm_y+y2-y1+1;
|
|
|
|
gadget->parent = NULL;
|
|
|
|
gadget->hotkey = -1;
|
|
|
|
}
|
|
|
|
|
2011-01-17 14:42:18 +00:00
|
|
|
void ui_gadget_delete_all( UI_DIALOG * dlg )
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
UI_GADGET * tmp;
|
|
|
|
|
2011-01-17 14:42:18 +00:00
|
|
|
while( dlg->gadget != NULL )
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2011-01-17 14:42:18 +00:00
|
|
|
tmp = dlg->gadget;
|
2006-03-20 17:12:09 +00:00
|
|
|
if (tmp->next == tmp )
|
|
|
|
{
|
2011-01-17 14:42:18 +00:00
|
|
|
dlg->gadget = NULL;
|
2006-03-20 17:12:09 +00:00
|
|
|
} else {
|
|
|
|
tmp->next->prev = tmp->prev;
|
|
|
|
tmp->prev->next = tmp->next;
|
2011-01-17 14:42:18 +00:00
|
|
|
dlg->gadget = tmp->next;
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
|
2014-09-06 23:27:57 +00:00
|
|
|
switch(tmp->kind)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2014-09-06 23:27:57 +00:00
|
|
|
case UI_GADGET_BUTTON::s_kind:
|
|
|
|
case UI_GADGET_LISTBOX::s_kind:
|
|
|
|
case UI_GADGET_SCROLLBAR::s_kind:
|
|
|
|
case UI_GADGET_RADIO::s_kind:
|
|
|
|
case UI_GADGET_CHECKBOX::s_kind:
|
|
|
|
case UI_GADGET_INPUTBOX::s_kind:
|
|
|
|
case UI_GADGET_USERBOX::s_kind:
|
|
|
|
case UI_GADGET_ICON::s_kind:
|
2014-12-20 04:36:09 +00:00
|
|
|
/* Handled by returned unique_ptr */
|
2014-09-08 00:08:17 +00:00
|
|
|
break;
|
2014-09-06 23:27:57 +00:00
|
|
|
default:
|
|
|
|
throw std::runtime_error("unknown gadget kind");
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-12-18 12:41:31 +00:00
|
|
|
#if 0
|
2011-01-17 14:42:18 +00:00
|
|
|
int is_under_another_window( UI_DIALOG * dlg, UI_GADGET * gadget )
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2011-01-17 14:42:18 +00:00
|
|
|
UI_DIALOG * temp;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2011-01-17 14:42:18 +00:00
|
|
|
temp = dlg->next;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
while( temp != NULL ) {
|
|
|
|
if ( ( gadget->x1 > temp->x) &&
|
|
|
|
( gadget->x1 < (temp->x+temp->width) ) &&
|
|
|
|
( gadget->y1 > temp->y) &&
|
|
|
|
( gadget->y1 < (temp->y+temp->height) )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
//gadget->status =1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( ( gadget->x2 > temp->x) &&
|
|
|
|
( gadget->x2 < (temp->x+temp->width) ) &&
|
|
|
|
( gadget->y2 > temp->y) &&
|
|
|
|
( gadget->y2 < (temp->y+temp->height) )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
//gadget->status =1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
temp = temp->next;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2011-10-23 09:08:47 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
int ui_mouse_on_gadget( UI_GADGET * gadget )
|
|
|
|
{
|
2011-10-23 09:08:47 +00:00
|
|
|
int x, y, z;
|
|
|
|
|
|
|
|
mouse_get_pos(&x, &y, &z);
|
|
|
|
if ((x >= gadget->x1) && (x <= gadget->x2-1) && (y >= gadget->y1) && (y <= gadget->y2-1) )
|
|
|
|
{
|
2011-12-18 12:41:31 +00:00
|
|
|
#if 0 // check is no longer required - if it is under another window, that dialog's handler would have returned 1
|
2012-03-03 12:19:15 +00:00
|
|
|
if (is_under_another_window(dlg, gadget))
|
2006-03-20 17:12:09 +00:00
|
|
|
return 0;
|
2011-10-23 09:08:47 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
return 1;
|
|
|
|
} else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-10-04 21:47:13 +00:00
|
|
|
static window_event_result ui_gadget_do(UI_DIALOG *dlg, UI_GADGET *g,const d_event &event)
|
2012-03-03 12:19:15 +00:00
|
|
|
{
|
|
|
|
switch( g->kind )
|
|
|
|
{
|
2014-09-06 23:27:57 +00:00
|
|
|
case UI_GADGET_BUTTON::s_kind:
|
2012-03-03 12:19:15 +00:00
|
|
|
return ui_button_do(dlg, (UI_GADGET_BUTTON *)g, event);
|
2014-09-06 23:27:57 +00:00
|
|
|
case UI_GADGET_LISTBOX::s_kind:
|
2012-03-03 12:19:15 +00:00
|
|
|
return ui_listbox_do(dlg, (UI_GADGET_LISTBOX *)g, event);
|
2014-09-06 23:27:57 +00:00
|
|
|
case UI_GADGET_SCROLLBAR::s_kind:
|
2012-03-03 12:19:15 +00:00
|
|
|
return ui_scrollbar_do(dlg, (UI_GADGET_SCROLLBAR *)g, event);
|
2014-09-06 23:27:57 +00:00
|
|
|
case UI_GADGET_RADIO::s_kind:
|
2012-03-03 12:19:15 +00:00
|
|
|
return ui_radio_do(dlg, (UI_GADGET_RADIO *)g, event);
|
2014-09-06 23:27:57 +00:00
|
|
|
case UI_GADGET_CHECKBOX::s_kind:
|
2012-03-03 12:19:15 +00:00
|
|
|
return ui_checkbox_do(dlg, (UI_GADGET_CHECKBOX *)g, event);
|
2014-09-06 23:27:57 +00:00
|
|
|
case UI_GADGET_INPUTBOX::s_kind:
|
2012-03-03 12:19:15 +00:00
|
|
|
return ui_inputbox_do(dlg, (UI_GADGET_INPUTBOX *)g, event);
|
2014-09-06 23:27:57 +00:00
|
|
|
case UI_GADGET_USERBOX::s_kind:
|
2012-03-03 12:19:15 +00:00
|
|
|
return ui_userbox_do(dlg, (UI_GADGET_USERBOX *)g, event);
|
2014-09-06 23:27:57 +00:00
|
|
|
case UI_GADGET_ICON::s_kind:
|
2012-03-03 12:19:15 +00:00
|
|
|
return ui_icon_do(dlg, (UI_GADGET_ICON *)g, event);
|
|
|
|
}
|
2014-08-06 02:10:49 +00:00
|
|
|
return window_event_result::ignored;
|
2012-03-03 12:19:15 +00:00
|
|
|
}
|
|
|
|
|
2014-08-06 02:10:49 +00:00
|
|
|
window_event_result ui_gadget_send_event(UI_DIALOG *dlg, event_type type, UI_GADGET *gadget)
|
2012-03-03 12:19:15 +00:00
|
|
|
{
|
|
|
|
event_gadget event;
|
|
|
|
|
|
|
|
event.type = type;
|
|
|
|
event.gadget = gadget;
|
|
|
|
|
|
|
|
if (gadget->parent)
|
2014-10-04 21:47:13 +00:00
|
|
|
return ui_gadget_do(dlg, gadget->parent, event);
|
2012-03-03 12:19:15 +00:00
|
|
|
|
2015-01-17 18:31:40 +00:00
|
|
|
return window_send_event(*ui_dialog_get_window(dlg), event);
|
2012-03-03 12:19:15 +00:00
|
|
|
}
|
|
|
|
|
2014-10-04 21:47:13 +00:00
|
|
|
UI_GADGET *ui_event_get_gadget(const d_event &event)
|
2012-03-03 12:19:15 +00:00
|
|
|
{
|
2014-10-04 21:47:13 +00:00
|
|
|
auto &e = static_cast<const event_gadget &>(event);
|
|
|
|
Assert(e.type >= EVENT_UI_GADGET_PRESSED); // Any UI event
|
|
|
|
return e.gadget;
|
2012-03-03 12:19:15 +00:00
|
|
|
}
|
|
|
|
|
2014-10-04 21:47:13 +00:00
|
|
|
window_event_result ui_dialog_do_gadgets(UI_DIALOG * dlg,const d_event &event)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2011-10-23 09:08:47 +00:00
|
|
|
int keypress = 0;
|
2006-03-20 17:12:09 +00:00
|
|
|
UI_GADGET * tmp, * tmp1;
|
2012-03-17 09:39:24 +00:00
|
|
|
window *wind;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2014-10-04 21:47:13 +00:00
|
|
|
if (event.type == EVENT_KEY_COMMAND)
|
2011-10-23 09:08:47 +00:00
|
|
|
keypress = event_key_get(event);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2011-01-17 14:42:18 +00:00
|
|
|
tmp = dlg->gadget;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2014-08-06 02:10:49 +00:00
|
|
|
if (tmp == NULL) return window_event_result::ignored;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
if (selected_gadget==NULL)
|
|
|
|
selected_gadget = tmp;
|
|
|
|
|
2011-01-17 14:42:18 +00:00
|
|
|
tmp1 = dlg->keyboard_focus_gadget;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (ui_mouse_on_gadget(tmp) && B1_JUST_PRESSED )
|
|
|
|
{
|
|
|
|
selected_gadget = tmp;
|
|
|
|
if (tmp->parent!=NULL)
|
|
|
|
{
|
|
|
|
while (tmp->parent != NULL )
|
|
|
|
tmp = tmp->parent;
|
2011-01-17 14:42:18 +00:00
|
|
|
dlg->keyboard_focus_gadget = tmp;
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-01-17 14:42:18 +00:00
|
|
|
dlg->keyboard_focus_gadget = tmp;
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( tmp->hotkey == keypress )
|
|
|
|
{
|
2011-01-17 14:42:18 +00:00
|
|
|
dlg->keyboard_focus_gadget = tmp;
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
tmp = tmp->next;
|
2011-01-17 14:42:18 +00:00
|
|
|
} while( tmp != dlg->gadget );
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2011-01-17 14:42:18 +00:00
|
|
|
if (dlg->keyboard_focus_gadget != NULL)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
switch (keypress )
|
|
|
|
{
|
|
|
|
case (KEY_TAB):
|
2011-01-17 14:42:18 +00:00
|
|
|
if ( dlg->keyboard_focus_gadget->when_tab != NULL )
|
|
|
|
dlg->keyboard_focus_gadget = dlg->keyboard_focus_gadget->when_tab;
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
|
|
|
case (KEY_TAB+KEY_SHIFTED):
|
2011-01-17 14:42:18 +00:00
|
|
|
if ( dlg->keyboard_focus_gadget->when_btab != NULL )
|
|
|
|
dlg->keyboard_focus_gadget = dlg->keyboard_focus_gadget->when_btab;
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
|
|
|
case (KEY_UP):
|
2011-01-17 14:42:18 +00:00
|
|
|
if ( dlg->keyboard_focus_gadget->when_up != NULL )
|
|
|
|
dlg->keyboard_focus_gadget = dlg->keyboard_focus_gadget->when_up;
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
|
|
|
case (KEY_DOWN):
|
2011-01-17 14:42:18 +00:00
|
|
|
if ( dlg->keyboard_focus_gadget->when_down != NULL )
|
|
|
|
dlg->keyboard_focus_gadget = dlg->keyboard_focus_gadget->when_down;
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
|
|
|
case (KEY_LEFT):
|
2011-01-17 14:42:18 +00:00
|
|
|
if ( dlg->keyboard_focus_gadget->when_left != NULL )
|
|
|
|
dlg->keyboard_focus_gadget = dlg->keyboard_focus_gadget->when_left;
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
|
|
|
case (KEY_RIGHT):
|
2011-01-17 14:42:18 +00:00
|
|
|
if ( dlg->keyboard_focus_gadget->when_right != NULL )
|
|
|
|
dlg->keyboard_focus_gadget = dlg->keyboard_focus_gadget->when_right;
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-06 02:10:49 +00:00
|
|
|
window_event_result rval = window_event_result::ignored;
|
2011-01-17 14:42:18 +00:00
|
|
|
if (dlg->keyboard_focus_gadget != tmp1)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2011-01-17 14:42:18 +00:00
|
|
|
if (dlg->keyboard_focus_gadget != NULL )
|
|
|
|
dlg->keyboard_focus_gadget->status = 1;
|
2006-03-20 17:12:09 +00:00
|
|
|
if (tmp1 != NULL )
|
|
|
|
tmp1->status = 1;
|
2014-08-06 02:10:49 +00:00
|
|
|
rval = window_event_result::handled;
|
2011-11-05 09:08:17 +00:00
|
|
|
|
|
|
|
if (keypress)
|
|
|
|
return rval;
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
|
2011-01-17 14:42:18 +00:00
|
|
|
tmp = dlg->gadget;
|
2012-03-17 09:39:24 +00:00
|
|
|
wind = ui_dialog_get_window(dlg);
|
2006-03-20 17:12:09 +00:00
|
|
|
do
|
|
|
|
{
|
2011-12-18 12:41:31 +00:00
|
|
|
// If it is under another dialog, that dialog's handler would have returned 1 for mouse events.
|
|
|
|
// Key events are handled in a priority depending on the window ordering.
|
2012-03-03 12:19:15 +00:00
|
|
|
//if (!is_under_another_window( dlg, tmp ))
|
|
|
|
rval = ui_gadget_do(dlg, tmp, event);
|
2012-03-17 09:39:24 +00:00
|
|
|
|
|
|
|
if (!window_exists(wind))
|
|
|
|
break;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
tmp = tmp->next;
|
2012-03-03 12:19:15 +00:00
|
|
|
} while(/*!rval &&*/ tmp != dlg->gadget); // have to look for pesky scrollbars in case an arrow button or arrow key are held down
|
2011-10-23 09:08:47 +00:00
|
|
|
|
|
|
|
return rval;
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UI_GADGET * ui_gadget_get_next( UI_GADGET * gadget )
|
|
|
|
{
|
|
|
|
UI_GADGET * tmp;
|
|
|
|
|
|
|
|
tmp = gadget->next;
|
|
|
|
|
|
|
|
while( tmp != gadget && (tmp->parent!=NULL) )
|
|
|
|
tmp = tmp->next;
|
|
|
|
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
UI_GADGET * ui_gadget_get_prev( UI_GADGET * gadget )
|
|
|
|
{
|
|
|
|
UI_GADGET * tmp;
|
|
|
|
|
|
|
|
tmp = gadget->prev;
|
|
|
|
|
|
|
|
while( tmp != gadget && (tmp->parent!=NULL) )
|
|
|
|
tmp = tmp->prev;
|
|
|
|
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
2011-01-17 14:42:18 +00:00
|
|
|
void ui_gadget_calc_keys( UI_DIALOG * dlg)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
UI_GADGET * tmp;
|
|
|
|
|
2011-01-17 14:42:18 +00:00
|
|
|
tmp = dlg->gadget;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
if (tmp==NULL) return;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
tmp->when_tab = ui_gadget_get_next(tmp);
|
|
|
|
tmp->when_btab = ui_gadget_get_prev(tmp);
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
2011-01-17 14:42:18 +00:00
|
|
|
} while( tmp != dlg->gadget );
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
}
|
2015-12-05 22:57:24 +00:00
|
|
|
|
|
|
|
}
|