Patch level : 4.0
Files correlati : Ricompilazione Demo : [ ] Commento : Risolti problemi di compilazione con vecchio wxWidgets git-svn-id: svn://10.65.10.50/trunk@15196 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
238527b5ba
commit
1faa2eb7f9
153
xvaga/xvaga.cpp
153
xvaga/xvaga.cpp
@ -176,13 +176,13 @@ const wxCursor* GetCursorResource(int rid)
|
||||
const wxString strName = ::GetResourceName("Cursor", rid);
|
||||
if (::wxFileExists(strName))
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if wxCHECK_VERSION(2,8,0)
|
||||
if (strName.EndsWith(".ico"))
|
||||
cursor = new wxCursor(strName, wxBITMAP_TYPE_ICO);
|
||||
else
|
||||
cursor = new wxCursor(strName, wxBITMAP_TYPE_CUR);
|
||||
#else
|
||||
cursor = wxSTANDARD_CURSOR;
|
||||
cursor = new wxCursor(strName, wxBITMAP_TYPE_CUR);
|
||||
#endif
|
||||
if (!cursor->Ok())
|
||||
{
|
||||
@ -1572,19 +1572,30 @@ public:
|
||||
|
||||
WINDOW xvt_ctl_create_def(WIN_DEF *win_def_p, WINDOW parent_win, long app_data)
|
||||
{
|
||||
WINDOW win = NULL_WIN;
|
||||
const wxRect rct = NormalizeRCT(&win_def_p->rct);
|
||||
wxWindow* pParent = (wxWindow*)parent_win;
|
||||
|
||||
WINDOW win = NULL_WIN;
|
||||
switch (win_def_p->wtype)
|
||||
{
|
||||
case WC_HSCROLL: /* horizontal scrollbar control */
|
||||
case WC_VSCROLL: /* vertical scrollbar control */
|
||||
{
|
||||
const wxRect rct = NormalizeRCT(&win_def_p->rct);
|
||||
long style = win_def_p->wtype == WC_HSCROLL ? wxSB_HORIZONTAL : wxSB_VERTICAL;
|
||||
TwxScrollBar* sb = new TwxScrollBar((wxWindow*)parent_win, win_def_p->v.ctl.ctrl_id,
|
||||
const long style = win_def_p->wtype == WC_HSCROLL ? wxSB_HORIZONTAL : wxSB_VERTICAL;
|
||||
TwxScrollBar* sb = new TwxScrollBar(pParent, win_def_p->v.ctl.ctrl_id,
|
||||
rct.GetPosition(), rct.GetSize(), style);
|
||||
win = (WINDOW)sb;
|
||||
}
|
||||
break;
|
||||
case WC_HGAUGE: /* horizontal progress bar control */
|
||||
case WC_VGAUGE: /* vertical progress bar control */
|
||||
{
|
||||
const long style = win_def_p->wtype == (WC_HGAUGE ? wxGA_HORIZONTAL : wxGA_VERTICAL);
|
||||
wxGauge* pg = new wxGauge(pParent, win_def_p->v.ctl.ctrl_id, app_data,
|
||||
rct.GetPosition(), rct.GetSize(), style);
|
||||
win = (WINDOW)pg;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
SORRY_BOX(); break;
|
||||
}
|
||||
@ -3587,9 +3598,12 @@ BOOLEAN xvt_menu_popup(MENU_ITEM *menu_p, WINDOW win, PNT pos,
|
||||
item = new wxMenuItem(&menu, mi->tag, mi->text, wxEmptyString, mi->checkable);
|
||||
menu.Append(item);
|
||||
#endif
|
||||
item->Enable(mi->enabled); // Fattibile solo dopo l'append
|
||||
if (mi->checkable)
|
||||
item->Check(mi->checked);
|
||||
if (item != NULL) // Non e' un sepatatore
|
||||
{
|
||||
item->Enable(mi->enabled); // Fattibile solo dopo l'append
|
||||
if (mi->checkable)
|
||||
item->Check(mi->checked);
|
||||
}
|
||||
}
|
||||
CAST_WIN(win, w);
|
||||
bool ok = w.PopupMenu(&menu, pos.h, pos.v);
|
||||
@ -3930,17 +3944,30 @@ char* xvt_res_get_str(int rid, char *s, int sz_s)
|
||||
|
||||
#define CAST_SCROLL(win, sb) XVT_ASSERT(win != NULL_WIN); wxScrollBar& sb = *(wxScrollBar*)win;
|
||||
#define CAST_SCROLL_TYPE(t, dir) const int dir = t == HSCROLL ? wxHORIZONTAL : wxVERTICAL;
|
||||
#define CAST_GAUGE(win, pb) XVT_ASSERT(win != NULL_WIN); wxGauge& pb = *(wxGauge*)win;
|
||||
|
||||
int xvt_sbar_get_pos(WINDOW win, SCROLL_TYPE t)
|
||||
{
|
||||
if (t == HSCROLL || t == VSCROLL)
|
||||
{
|
||||
CAST_WIN(win, w);
|
||||
CAST_SCROLL_TYPE(t, dir);
|
||||
return w.GetScrollPos(dir);
|
||||
}
|
||||
CAST_SCROLL(win, sb);
|
||||
return sb.GetThumbPosition();
|
||||
switch (t)
|
||||
{
|
||||
case HSCROLL:
|
||||
case VSCROLL:
|
||||
{
|
||||
CAST_WIN(win, w);
|
||||
CAST_SCROLL_TYPE(t, dir);
|
||||
return w.GetScrollPos(dir);
|
||||
}
|
||||
case HVGAUGE:
|
||||
{
|
||||
CAST_GAUGE(win, g);
|
||||
return g.GetValue();
|
||||
}
|
||||
default:
|
||||
{
|
||||
CAST_SCROLL(win, sb);
|
||||
return sb.GetThumbPosition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int xvt_sbar_get_proportion(WINDOW win, SCROLL_TYPE t)
|
||||
@ -3966,25 +3993,47 @@ void xvt_sbar_get_range(WINDOW win, SCROLL_TYPE t, int *minp, int *maxp)
|
||||
}
|
||||
else
|
||||
{
|
||||
CAST_SCROLL(win, sb);
|
||||
*maxp = sb.GetRange();
|
||||
if (t == HVGAUGE)
|
||||
{
|
||||
CAST_GAUGE(win, g);
|
||||
*maxp = g.GetRange();
|
||||
}
|
||||
else
|
||||
{
|
||||
CAST_SCROLL(win, sb);
|
||||
*maxp = sb.GetRange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void xvt_sbar_set_pos(WINDOW win, SCROLL_TYPE t, int pos)
|
||||
{
|
||||
if (t == HSCROLL || t == VSCROLL)
|
||||
{
|
||||
CAST_WIN(win, w);
|
||||
CAST_SCROLL_TYPE(t, dir);
|
||||
w.SetScrollPos(dir, pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
CAST_SCROLL(win, sb);
|
||||
const int range = sb.GetRange();
|
||||
const int size = sb.GetThumbSize();
|
||||
sb.SetScrollbar(pos, size, range, size);
|
||||
switch(t)
|
||||
{
|
||||
case HSCROLL:
|
||||
case VSCROLL:
|
||||
{
|
||||
CAST_WIN(win, w);
|
||||
CAST_SCROLL_TYPE(t, dir);
|
||||
w.SetScrollPos(dir, pos);
|
||||
}
|
||||
break;
|
||||
case HVGAUGE:
|
||||
{
|
||||
CAST_GAUGE(win, g);
|
||||
if (g.GetRange() <= 1)
|
||||
g.Pulse();
|
||||
else
|
||||
g.SetValue(pos);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
CAST_SCROLL(win, sb);
|
||||
const int range = sb.GetRange();
|
||||
const int size = sb.GetThumbSize();
|
||||
sb.SetScrollbar(pos, size, range, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4009,21 +4058,33 @@ void xvt_sbar_set_proportion(WINDOW win, SCROLL_TYPE t, int proportion)
|
||||
|
||||
void xvt_sbar_set_range(WINDOW win, SCROLL_TYPE t, int min, int max)
|
||||
{
|
||||
XVT_ASSERT(min == 0);
|
||||
if (t == HSCROLL || t == VSCROLL)
|
||||
{
|
||||
CAST_WIN(win, w);
|
||||
CAST_SCROLL_TYPE(t, dir);
|
||||
const int pos = w.GetScrollPos(dir);
|
||||
const int size = w.GetScrollThumb(dir);
|
||||
w.SetScrollbar(dir, pos, size, max);
|
||||
}
|
||||
else
|
||||
{
|
||||
CAST_SCROLL(win, sb);
|
||||
const int pos = sb.GetThumbPosition();
|
||||
const int size = sb.GetThumbSize();
|
||||
sb.SetScrollbar(pos, size, max, size);
|
||||
XVT_ASSERT(min == 0 && max >= min);
|
||||
switch (t)
|
||||
{
|
||||
case HSCROLL:
|
||||
case VSCROLL:
|
||||
{
|
||||
CAST_WIN(win, w);
|
||||
CAST_SCROLL_TYPE(t, dir);
|
||||
const int pos = w.GetScrollPos(dir);
|
||||
const int size = w.GetScrollThumb(dir);
|
||||
w.SetScrollbar(dir, pos, size, max);
|
||||
}
|
||||
break;
|
||||
case HVGAUGE:
|
||||
{
|
||||
CAST_GAUGE(win, g);
|
||||
g.SetRange(max);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
CAST_SCROLL(win, sb);
|
||||
const int pos = sb.GetThumbPosition();
|
||||
const int size = sb.GetThumbSize();
|
||||
sb.SetScrollbar(pos, size, max, size);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,9 @@ WC_LISTEDIT, /* edit with field list */
|
||||
WC_GROUPBOX, /* group box */
|
||||
WC_TEXTEDIT, /* text edit object */
|
||||
WC_ICON, /* icon control */
|
||||
WO_TE /* text edit */
|
||||
WO_TE, /* text edit */
|
||||
WC_HGAUGE, /* horizontal progress bar */
|
||||
WC_VGAUGE, /* vertical progress bar */
|
||||
} WIN_TYPE;
|
||||
|
||||
typedef enum {
|
||||
@ -240,6 +242,7 @@ typedef enum { /* type of scrollbar */
|
||||
HSCROLL, /* horizontal */
|
||||
VSCROLL, /* vertical */
|
||||
HVSCROLL, /* either */
|
||||
HVGAUGE /* progress bar */
|
||||
|
||||
} SCROLL_TYPE;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user