Patch level : 10.0
Files correlati : Ricompilazione Demo : [ ] Commento : Slider controls git-svn-id: svn://10.65.10.50/trunk@16634 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
da1d0a937b
commit
a6f0eea254
@ -1,6 +1,6 @@
|
||||
/* STATBAR.H for dynamic custom control for XVT/Design 2.01
|
||||
|
||||
$Revision: 1.4 $ $Author: guy $ $Date: 2008-04-04 16:04:47 $
|
||||
$Revision: 1.5 $ $Author: guy $ $Date: 2008-05-20 14:06:05 $
|
||||
|
||||
This code was written by Christopher Williamson,
|
||||
May be distributed in object form only when embedded in a
|
||||
@ -48,9 +48,10 @@ XVTDLL BOOLEAN xvt_toolbar_add_control(WINDOW win, int cid, TOOL_TYPE type, cons
|
||||
int ico, int cust_width, int idx);
|
||||
XVTDLL WINDOW xvt_toolbar_create(int cid, int left, int top, int right, int bottom,
|
||||
long style, WINDOW parent_win);
|
||||
XVTDLL void xvt_toolbar_enable_control(WINDOW win, int cid, BOOLEAN on);
|
||||
XVTDLL void xvt_toolbar_realize(WINDOW win);
|
||||
XVTDLL void xvt_toolbar_show_control(WINDOW win, int cid, BOOLEAN on);
|
||||
XVTDLL void xvt_toolbar_enable_control(WINDOW win, int cid, BOOLEAN on);
|
||||
XVTDLL void xvt_toolbar_realize(WINDOW win);
|
||||
XVTDLL BOOLEAN xvt_toolbar_set_last_tool(WINDOW win, int cid);
|
||||
XVTDLL void xvt_toolbar_show_control(WINDOW win, int cid, BOOLEAN on);
|
||||
|
||||
#if defined(_cplusplus) || defined(__cplusplus)
|
||||
} /* extern "C" */
|
||||
|
162
xvaga/xvaga.cpp
162
xvaga/xvaga.cpp
@ -406,7 +406,6 @@ void xvt_app_allow_quit(void)
|
||||
void xvt_app_create(int argc, char **argv, unsigned long flags,
|
||||
EVENT_HANDLER eh, XVT_CONFIG *config)
|
||||
{
|
||||
::wxInitAllImageHandlers();
|
||||
xvt_fsys_get_default_dir(NULL); // Init Startup Directory
|
||||
|
||||
#ifdef SPEECH_API
|
||||
@ -2974,9 +2973,11 @@ 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;
|
||||
#define CAST_SLIDER(win, sc) XVT_ASSERT(win != NULL_WIN); wxSlider& sc = *(wxSlider*)win;
|
||||
|
||||
int xvt_sbar_get_pos(WINDOW win, SCROLL_TYPE t)
|
||||
int xvt_sbar_get_pos(WINDOW win, SCROLL_TYPE t)
|
||||
{
|
||||
int pos = 0;
|
||||
switch (t)
|
||||
{
|
||||
case HSCROLL:
|
||||
@ -2984,55 +2985,86 @@ int xvt_sbar_get_pos(WINDOW win, SCROLL_TYPE t)
|
||||
{
|
||||
CAST_WIN(win, w);
|
||||
CAST_SCROLL_TYPE(t, dir);
|
||||
return w.GetScrollPos(dir);
|
||||
pos = w.GetScrollPos(dir);
|
||||
}
|
||||
break;
|
||||
case HVGAUGE:
|
||||
{
|
||||
CAST_GAUGE(win, g);
|
||||
return g.GetValue();
|
||||
pos = g.GetValue();
|
||||
}
|
||||
break;
|
||||
case HVSLIDER:
|
||||
{
|
||||
CAST_SLIDER(win, g);
|
||||
pos = g.GetValue();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
CAST_SCROLL(win, sb);
|
||||
return sb.GetThumbPosition();
|
||||
pos = sb.GetThumbPosition();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
int xvt_sbar_get_proportion(WINDOW win, SCROLL_TYPE t)
|
||||
int xvt_sbar_get_proportion(WINDOW win, SCROLL_TYPE t)
|
||||
{
|
||||
if (t == HSCROLL || t == VSCROLL)
|
||||
{
|
||||
CAST_WIN(win, w);
|
||||
CAST_SCROLL_TYPE(t, dir);
|
||||
return w.GetScrollThumb(dir);
|
||||
}
|
||||
CAST_SCROLL(win, sb);
|
||||
return sb.GetThumbSize();
|
||||
int p = 1;
|
||||
switch (t)
|
||||
{
|
||||
case HSCROLL:
|
||||
case VSCROLL:
|
||||
{
|
||||
CAST_WIN(win, w);
|
||||
CAST_SCROLL_TYPE(t, dir);
|
||||
p = w.GetScrollThumb(dir);
|
||||
}
|
||||
break;
|
||||
case HVSLIDER:
|
||||
{
|
||||
CAST_SLIDER(win, sc);
|
||||
p = sc.GetPageSize();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
CAST_SCROLL(win, sb);
|
||||
p = sb.GetThumbSize();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
void xvt_sbar_get_range(WINDOW win, SCROLL_TYPE t, int *minp, int *maxp)
|
||||
{
|
||||
*minp = 0;
|
||||
if (t == HSCROLL || t == VSCROLL)
|
||||
{
|
||||
CAST_WIN(win, w);
|
||||
CAST_SCROLL_TYPE(t, dir);
|
||||
*maxp = w.GetScrollRange(dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (t == HVGAUGE)
|
||||
switch (t)
|
||||
{
|
||||
case HSCROLL:
|
||||
case VSCROLL:
|
||||
{
|
||||
CAST_WIN(win, w);
|
||||
CAST_SCROLL_TYPE(t, dir);
|
||||
*maxp = w.GetScrollRange(dir);
|
||||
}
|
||||
break;
|
||||
case HVGAUGE:
|
||||
{
|
||||
CAST_GAUGE(win, g);
|
||||
*maxp = g.GetRange();
|
||||
}
|
||||
else
|
||||
break;
|
||||
default:
|
||||
{
|
||||
CAST_SCROLL(win, sb);
|
||||
*maxp = sb.GetRange();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void xvt_sbar_set_pos(WINDOW win, SCROLL_TYPE t, int pos)
|
||||
@ -3050,13 +3082,18 @@ void xvt_sbar_set_pos(WINDOW win, SCROLL_TYPE t, int pos)
|
||||
case HVGAUGE:
|
||||
{
|
||||
CAST_GAUGE(win, g);
|
||||
|
||||
if (g.GetRange() <= 1)
|
||||
g.Pulse();
|
||||
else
|
||||
g.SetValue(pos);
|
||||
}
|
||||
break;
|
||||
case HVSLIDER:
|
||||
{
|
||||
CAST_SLIDER(win, g);
|
||||
g.SetValue(pos);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
CAST_SCROLL(win, sb);
|
||||
@ -3064,26 +3101,40 @@ void xvt_sbar_set_pos(WINDOW win, SCROLL_TYPE t, int pos)
|
||||
const int size = sb.GetThumbSize();
|
||||
sb.SetScrollbar(pos, size, range, size);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void xvt_sbar_set_proportion(WINDOW win, SCROLL_TYPE t, int proportion)
|
||||
{
|
||||
if (t == HSCROLL || t == VSCROLL)
|
||||
{
|
||||
CAST_WIN(win, w);
|
||||
CAST_SCROLL_TYPE(t, dir);
|
||||
const int pos = w.GetScrollPos(dir);
|
||||
const int range = w.GetScrollRange(dir);
|
||||
w.SetScrollbar(dir, pos, proportion, range);
|
||||
}
|
||||
else
|
||||
{
|
||||
CAST_SCROLL(win, sb);
|
||||
const int pos = sb.GetThumbPosition();
|
||||
const int range = sb.GetRange();
|
||||
sb.SetScrollbar(pos, proportion, range, proportion);
|
||||
}
|
||||
switch (t)
|
||||
{
|
||||
case HSCROLL:
|
||||
case VSCROLL:
|
||||
{
|
||||
CAST_WIN(win, w);
|
||||
CAST_SCROLL_TYPE(t, dir);
|
||||
const int pos = w.GetScrollPos(dir);
|
||||
const int range = w.GetScrollRange(dir);
|
||||
w.SetScrollbar(dir, pos, proportion, range);
|
||||
}
|
||||
break;
|
||||
case HVSLIDER:
|
||||
{
|
||||
CAST_SLIDER(win, sc);
|
||||
sc.SetPageSize(proportion);
|
||||
sc.SetTickFreq(sc.GetMax()/proportion, 0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
CAST_SCROLL(win, sb);
|
||||
const int pos = sb.GetThumbPosition();
|
||||
const int range = sb.GetRange();
|
||||
sb.SetScrollbar(pos, proportion, range, proportion);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void xvt_sbar_set_range(WINDOW win, SCROLL_TYPE t, int min, int max)
|
||||
@ -3107,6 +3158,12 @@ void xvt_sbar_set_range(WINDOW win, SCROLL_TYPE t, int min, int max)
|
||||
g.SetRange(max);
|
||||
}
|
||||
break;
|
||||
case HVSLIDER:
|
||||
{
|
||||
CAST_SLIDER(win, g);
|
||||
g.SetRange(min, max);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
CAST_SCROLL(win, sb);
|
||||
@ -3784,6 +3841,11 @@ BOOLEAN xvt_fsys_removefile(const char *pathname)
|
||||
// Timers
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
struct tm* xvt_time_now()
|
||||
{
|
||||
return wxDateTime::GetTmNow();
|
||||
}
|
||||
|
||||
long xvt_timer_create(WINDOW win, long interval)
|
||||
{
|
||||
CAST_TWIN(win, w);
|
||||
@ -3853,18 +3915,20 @@ long xvt_vobj_get_attr(WINDOW win, long data)
|
||||
xcc[4].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
|
||||
xcc[5].type = XVT_COLOR_HIGHLIGHT;
|
||||
xcc[5].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
|
||||
xcc[6].type = XVT_COLOR_TROUGH;
|
||||
xcc[6].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||
|
||||
// AGA components
|
||||
xcc[6].type = XVT_COLOR_CAPTIONLT;
|
||||
xcc[6].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_ACTIVECAPTION));
|
||||
xcc[7].type = XVT_COLOR_CAPTIONDK;
|
||||
xcc[7].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION));
|
||||
xcc[8].type = XVT_COLOR_CAPTIONTEXT;
|
||||
xcc[8].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT));
|
||||
xcc[7].type = XVT_COLOR_CAPTIONLT;
|
||||
xcc[7].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_ACTIVECAPTION));
|
||||
xcc[8].type = XVT_COLOR_CAPTIONDK;
|
||||
xcc[8].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION));
|
||||
xcc[9].type = XVT_COLOR_CAPTIONTEXT;
|
||||
xcc[9].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT));
|
||||
|
||||
// Last (NULL) component
|
||||
xcc[9].type = XVT_COLOR_NULL;
|
||||
xcc[9].color = 0;
|
||||
xcc[10].type = XVT_COLOR_NULL;
|
||||
xcc[10].color = 0;
|
||||
|
||||
ret = (long)xcc;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ bool TMainApp::OnInit()
|
||||
const wxString strApp = strWrk.GetName().Lower();
|
||||
m_sic = new wxSingleInstanceChecker(strApp);
|
||||
|
||||
::wxInitAllImageHandlers();
|
||||
m_Locale.Init(wxLocale::GetSystemLanguage()); // wxLANGUAGE_ITALIAN
|
||||
|
||||
if (GetComCtl32Version() >= 600 && ::wxDisplayDepth() >= 32)
|
||||
|
@ -106,6 +106,7 @@ XVTDLL void xvt_dwin_draw_polyline(WINDOW win, const PNT *lpnts, int np
|
||||
XVTDLL void xvt_dwin_draw_rect(WINDOW win, RCT *rctp);
|
||||
XVTDLL void xvt_dwin_draw_roundrect(WINDOW win, const RCT *rctp, int oval_width, int oval_height);
|
||||
XVTDLL void xvt_dwin_draw_dotted_rect(WINDOW win, RCT *rctp); // Added by Guy
|
||||
XVTDLL void xvt_dwin_draw_tool(WINDOW win, int x, int y, int rid, int size); // Added by Guy
|
||||
XVTDLL void xvt_dwin_draw_set_pos(WINDOW win, PNT pnt);
|
||||
XVTDLL void xvt_dwin_draw_text(WINDOW win, int x, int y, const char *s, int len);
|
||||
XVTDLL RCT* xvt_dwin_get_clip(WINDOW win, RCT* rct);
|
||||
@ -376,8 +377,11 @@ XVTDLL BOOLEAN xvt_sys_test_network_version();
|
||||
XVTDLL void xvt_sys_searchenv(const char *filename, const char *varname, char *pathname);
|
||||
XVTDLL void xvt_sys_sorry_box(const char* func, const char* file, int line);
|
||||
XVTDLL void xvt_sys_deprecated_box(const char * file, int line);
|
||||
|
||||
XVTDLL struct tm* xvt_time_now();
|
||||
XVTDLL long xvt_timer_create(WINDOW win, long interval);
|
||||
XVTDLL void xvt_timer_destroy(long id);
|
||||
|
||||
XVTDLL void xvt_vobj_destroy(WINDOW win);
|
||||
XVTDLL long xvt_vobj_get_attr(WINDOW win, long data);
|
||||
XVTDLL RCT* xvt_vobj_get_client_rect(WINDOW win, RCT *rctp);
|
||||
|
@ -232,6 +232,8 @@ WC_NOTEBK, /* notebook control */
|
||||
WC_HTML, /* HTML control */
|
||||
WC_TREE, /* tree view */
|
||||
WC_OUTLOOKBAR, /* Barra di outlook */
|
||||
WC_HSLIDER, /* horizontal slider control */
|
||||
WC_VSLIDER, /* vertical slider control */
|
||||
} WIN_TYPE;
|
||||
|
||||
typedef enum {
|
||||
@ -246,7 +248,8 @@ typedef enum { /* type of scrollbar */
|
||||
HSCROLL, /* horizontal */
|
||||
VSCROLL, /* vertical */
|
||||
HVSCROLL, /* either */
|
||||
HVGAUGE /* progress bar */
|
||||
HVGAUGE, /* progress bar */
|
||||
HVSLIDER, /* slider */
|
||||
|
||||
} SCROLL_TYPE;
|
||||
|
||||
@ -263,7 +266,6 @@ typedef enum e_treeview_node_type {
|
||||
typedef XVT_CALLCONV_TYPEDEF( BOOLEAN, XVT_TREEVIEW_CALLBACK,
|
||||
(WINDOW ctl_win, XVT_TREEVIEW_NODE node) );
|
||||
|
||||
|
||||
typedef struct s_ctlinfo {
|
||||
|
||||
WIN_TYPE type;
|
||||
|
117
xvaga/xvtctl.cpp
117
xvaga/xvtctl.cpp
@ -42,8 +42,8 @@ const wxBitmap& _GetToolResource(int nIcon, int nDesiredSize)
|
||||
{
|
||||
static wxHashTable _tool_icons;
|
||||
|
||||
if (nDesiredSize <= 0) nDesiredSize = 32; else
|
||||
if (nDesiredSize > 512) nDesiredSize = 512;
|
||||
if (nDesiredSize < 16) nDesiredSize = 16; else
|
||||
if (nDesiredSize > 128) nDesiredSize = 128;
|
||||
const long nCode = 1000*nIcon + nDesiredSize;
|
||||
wxBitmap* bmp = (wxBitmap*)_tool_icons.Get(nCode);
|
||||
if (bmp == NULL)
|
||||
@ -58,10 +58,10 @@ const wxBitmap& _GetToolResource(int nIcon, int nDesiredSize)
|
||||
{
|
||||
const wxIcon ico(strName, wxBITMAP_TYPE_ICO);
|
||||
bmp = new wxBitmap(ico);
|
||||
} else
|
||||
if (strName.EndsWith(".png"))
|
||||
}
|
||||
else
|
||||
{
|
||||
wxImage img(strName, wxBITMAP_TYPE_PNG);
|
||||
wxImage img(strName, wxBITMAP_TYPE_ANY);
|
||||
img.Rescale(nDesiredSize, nDesiredSize, wxIMAGE_QUALITY_HIGH);
|
||||
bmp = new wxBitmap(img);
|
||||
}
|
||||
@ -188,11 +188,18 @@ WINDOW xvt_ctl_create_def(WIN_DEF *win_def_p, WINDOW parent_win, long app_data)
|
||||
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, id, app_data,
|
||||
rct.GetPosition(), rct.GetSize(), style);
|
||||
wxGauge* pg = new wxGauge(pParent, id, app_data, rct.GetPosition(), rct.GetSize(), style);
|
||||
win = (WINDOW)pg;
|
||||
}
|
||||
break;
|
||||
case WC_HSLIDER: /* horizontal slider control */
|
||||
case WC_VSLIDER: /* vertical slider control */
|
||||
{
|
||||
const long style = win_def_p->wtype == WC_HSLIDER ? wxSL_HORIZONTAL : wxSL_VERTICAL;
|
||||
wxSlider* sc = new wxSlider(pParent, id, 0, 0, app_data, rct.GetPosition(), rct.GetSize(), style);
|
||||
win = (WINDOW)sc;
|
||||
}
|
||||
break;
|
||||
case WC_PUSHBUTTON: /* bottone normale */
|
||||
{
|
||||
wxButton* pb = NULL;
|
||||
@ -221,7 +228,7 @@ WINDOW xvt_ctl_create_def(WIN_DEF *win_def_p, WINDOW parent_win, long app_data)
|
||||
case WC_RADIOBUTTON: /* radio button */
|
||||
{
|
||||
wxRadioButton* rb = new wxRadioButton(pParent, id, win_def_p->text,
|
||||
rct.GetPosition(), rct.GetSize());
|
||||
rct.GetPosition(), rct.GetSize(), wxRB_SINGLE);
|
||||
win = (WINDOW)rb;
|
||||
}
|
||||
break;
|
||||
@ -337,7 +344,7 @@ BOOLEAN xvt_pane_add(WINDOW win, WINDOW pane, const char* name, int dock, int fl
|
||||
return done;
|
||||
}
|
||||
|
||||
static wxAuiPaneInfo* Win2Pane(WINDOW win)
|
||||
static wxAuiPaneInfo* LockPane(WINDOW win)
|
||||
{
|
||||
wxWindow* pwin = (wxWindow*)win;
|
||||
wxAuiManager* pManager = wxAuiManager::GetManager(pwin);
|
||||
@ -345,29 +352,38 @@ static wxAuiPaneInfo* Win2Pane(WINDOW win)
|
||||
{
|
||||
wxAuiPaneInfo& pane = pManager->GetPane(pwin);
|
||||
if (pane.IsOk())
|
||||
{
|
||||
pManager->Update();
|
||||
return &pane;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void UnlockPane(WINDOW win)
|
||||
{
|
||||
wxWindow* pwin = (wxWindow*)win;
|
||||
wxAuiManager* pManager = wxAuiManager::GetManager(pwin);
|
||||
if (pManager != NULL)
|
||||
pManager->Update();
|
||||
}
|
||||
|
||||
BOOLEAN xvt_pane_set_title(WINDOW win, const char* title)
|
||||
{
|
||||
wxAuiPaneInfo* pane = Win2Pane(win);
|
||||
wxAuiPaneInfo* pane = LockPane(win);
|
||||
if (pane != NULL)
|
||||
{
|
||||
pane->Caption(title);
|
||||
UnlockPane(win);
|
||||
}
|
||||
return pane != NULL;
|
||||
}
|
||||
|
||||
XVTDLL BOOLEAN xvt_pane_change_flags(WINDOW win, int set, int rst)
|
||||
{
|
||||
wxAuiPaneInfo* pane = Win2Pane(win);
|
||||
wxAuiPaneInfo* pane = LockPane(win);
|
||||
if (pane != NULL && (set || rst))
|
||||
{
|
||||
if (set) pane->SetFlag(set, true);
|
||||
if (rst) pane->SetFlag(rst, false);
|
||||
UnlockPane(win);
|
||||
}
|
||||
return pane != NULL;
|
||||
}
|
||||
@ -380,7 +396,10 @@ XVTDLL BOOLEAN xvt_pane_detach(WINDOW win)
|
||||
wxWindow* pwin = (wxWindow*)win;
|
||||
wxAuiManager* pManager = wxAuiManager::GetManager(pwin);
|
||||
if (pManager != NULL)
|
||||
{
|
||||
ok = pManager->DetachPane(pwin);
|
||||
pManager->Update();
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -639,11 +658,7 @@ int TwxTreeCtrl::img2int(XVT_IMAGE xvt_img)
|
||||
int i = -1;
|
||||
if (xvt_img != NULL)
|
||||
{
|
||||
#if wxCHECK_VERSION(2,8,7)
|
||||
i = m_img[xvt_img] - 1; // Ho memorizzato indice+1
|
||||
#else
|
||||
i = (int)m_img.Get((long)xvt_img) - 1;
|
||||
#endif
|
||||
if (i < 0) // Immagine sconosciuta
|
||||
{
|
||||
const wxImage& img = *(wxImage*)xvt_img;
|
||||
@ -678,11 +693,7 @@ int TwxTreeCtrl::img2int(XVT_IMAGE xvt_img)
|
||||
}
|
||||
}
|
||||
i = il->Add(wxBitmap(img));
|
||||
#if wxCHECK_VERSION(2,8,7)
|
||||
m_img[xvt_img] = i+1; // Memorizzo indice+1
|
||||
#else
|
||||
m_img.Put((long)xvt_img, (wxObject*)(i+1)); // Memorizzo indice+1
|
||||
#endif
|
||||
}
|
||||
if (i < 0)
|
||||
SORRY_BOX();
|
||||
@ -711,11 +722,7 @@ void TwxTreeCtrl::SetNodeImages(const wxTreeItemId& id, XVT_IMAGE item_image,
|
||||
|
||||
wxFont TwxTreeCtrl::GetFont() const
|
||||
{
|
||||
#if wxCHECK_VERSION(2,8,7)
|
||||
return m_font.IsOk() ? m_font : wxTreeCtrl::GetFont();
|
||||
#else
|
||||
return wxTreeCtrl::GetFont();
|
||||
#endif
|
||||
}
|
||||
|
||||
void TwxTreeCtrl::Suspend()
|
||||
@ -833,13 +840,13 @@ BOOLEAN xvt_treeview_expand_node(WINDOW win, XVT_TREEVIEW_NODE node, BOOLEAN rec
|
||||
if (ok)
|
||||
{
|
||||
CAST_TREEVIEW(win, tv);
|
||||
tv.Suspend();
|
||||
const wxTreeItemId id(node);
|
||||
#if wxCHECK_VERSION(2,8,7)
|
||||
if (recurse)
|
||||
tv.ExpandAllChildren(id);
|
||||
else
|
||||
#endif
|
||||
tv.Expand(id);
|
||||
tv.Resume();
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -902,9 +909,15 @@ void xvt_treeview_select_node(WINDOW win, XVT_TREEVIEW_NODE node, BOOLEAN sel)
|
||||
{
|
||||
CAST_TREEVIEW(win, tv);
|
||||
const wxTreeItemId id(node);
|
||||
tv.SelectItem(id, sel != 0);
|
||||
if (sel)
|
||||
{
|
||||
tv.Suspend();
|
||||
tv.SelectItem(id, true);
|
||||
tv.EnsureVisible(id);
|
||||
tv.Resume();
|
||||
}
|
||||
else
|
||||
tv.SelectItem(id, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1198,7 +1211,7 @@ void TwxToolBar::OnTool(wxCommandEvent& evt)
|
||||
EVENT e; memset(&e, 0, sizeof(EVENT));
|
||||
e.type = E_CONTROL;
|
||||
e.v.ctl.id = evt.GetId();
|
||||
e.v.ctl.ci.type = WC_PUSHBUTTON;
|
||||
e.v.ctl.ci.type = WC_ICON; // WC_PUSHBUTTON entra in conflitto coi bottoni
|
||||
e.v.ctl.ci.win = WINDOW(this);
|
||||
TwxWindow* win = (TwxWindow*)GetParent();
|
||||
win->DoXvtEvent(e);
|
||||
@ -1229,10 +1242,9 @@ BOOLEAN xvt_toolbar_add_control(WINDOW win, int cid, TOOL_TYPE type, const char
|
||||
{
|
||||
case TOOL_SEPARATOR:
|
||||
if (idx < 0)
|
||||
tb.AddSeparator();
|
||||
ok = tb.AddSeparator() != NULL;
|
||||
else
|
||||
tb.InsertSeparator(idx);
|
||||
ok = TRUE;
|
||||
ok = tb.InsertSeparator(idx) != NULL;
|
||||
break;
|
||||
default:
|
||||
{
|
||||
@ -1255,8 +1267,8 @@ WINDOW xvt_toolbar_create(int cid, int left, int top, int right, int bottom, lon
|
||||
{
|
||||
const wxPoint ptPos(left, top);
|
||||
wxSize szSize(right-left, bottom-top);
|
||||
nStyle |= wxNO_BORDER | wxTB_FLAT | wxTB_NODIVIDER;
|
||||
int nIcoSize = 16;
|
||||
nStyle |= wxNO_BORDER | wxTB_NODIVIDER; // wxTB_FLAT non disegna il bordo!
|
||||
int nIcoSize = 24;
|
||||
if (bottom > 0)
|
||||
{
|
||||
nStyle |= wxTB_HORIZONTAL;
|
||||
@ -1282,13 +1294,34 @@ void xvt_toolbar_enable_control(WINDOW win, int cid, BOOLEAN on)
|
||||
ptb->EnableTool(cid, on != 0);
|
||||
}
|
||||
|
||||
BOOLEAN xvt_toolbar_set_last_tool(WINDOW win, int id)
|
||||
{
|
||||
BOOLEAN bMoved = FALSE;
|
||||
wxToolBar* ptb = Win2Bar(win);
|
||||
if (ptb != NULL) // Is a valid toolbar?
|
||||
{
|
||||
const int pos = ptb->GetToolPos(id);
|
||||
if (pos >= 0)
|
||||
{
|
||||
const int nCount = ptb->GetToolsCount();
|
||||
if (pos < nCount-1)
|
||||
{
|
||||
wxToolBarToolBase* tool = ptb->RemoveTool(id);
|
||||
ptb->InsertTool(nCount-1, tool);
|
||||
}
|
||||
bMoved = TRUE;
|
||||
}
|
||||
}
|
||||
return bMoved;
|
||||
}
|
||||
|
||||
void xvt_toolbar_realize(WINDOW win)
|
||||
{
|
||||
wxToolBar* ptb = Win2Bar(win);
|
||||
if (ptb != NULL) // Is a valid toolbar?
|
||||
{
|
||||
ptb->Realize(); // Update tools
|
||||
wxAuiPaneInfo* pi = Win2Pane(win);
|
||||
wxAuiPaneInfo* pi = LockPane(win);
|
||||
if (pi != NULL)
|
||||
{
|
||||
const wxSize szBar = ptb->GetSize();
|
||||
@ -1296,7 +1329,7 @@ void xvt_toolbar_realize(WINDOW win)
|
||||
{
|
||||
pi->MinSize(szBar);
|
||||
pi->BestSize(szBar);
|
||||
Win2Pane(win); // calls wxAuiManager::Update()
|
||||
UnlockPane(win);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1308,3 +1341,13 @@ void xvt_toolbar_show_control(WINDOW win, int cid, BOOLEAN on)
|
||||
if (ptb != NULL && cid > 0)
|
||||
ptb->EnableTool(cid, on != 0); // Per ora non so come si faccia
|
||||
}
|
||||
|
||||
void xvt_dwin_draw_tool(WINDOW win, int x, int y, int rid, int size)
|
||||
{
|
||||
const wxBitmap& bmp = _GetToolResource(rid, size);
|
||||
if (bmp.IsOk())
|
||||
{
|
||||
wxDC& dc = GetTDCMapper().GetDC(win);
|
||||
dc.DrawBitmap(bmp, x, y);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "xvtwin.h"
|
||||
|
||||
#include "wx/aui/aui.h"
|
||||
#include "wx/dcbuffer.h"
|
||||
#include "wx/notebook.h"
|
||||
#include "wx/treectrl.h"
|
||||
#include "wx/vlbox.h"
|
||||
@ -244,7 +245,8 @@ wxDC& TDC::GetDC(bool bPaint)
|
||||
if (bPaint)
|
||||
{
|
||||
KillDC();
|
||||
_dc = new wxPaintDC(_owner);
|
||||
//_dc = new wxPaintDC(_owner);
|
||||
_dc = new wxAutoBufferedPaintDC(_owner);
|
||||
_dirty = -1;
|
||||
}
|
||||
else
|
||||
@ -766,14 +768,14 @@ void TwxWindow::OnScroll(wxScrollEvent& evt)
|
||||
SCROLL_CONTROL sc = ConvertScrollToXVT(evt.GetEventType());
|
||||
if (sc != SC_NONE)
|
||||
{
|
||||
const wxScrollBar* sb = (wxScrollBar*)evt.GetEventObject();
|
||||
const wxSize sz = sb->GetSize();
|
||||
wxWindow* ctl = (wxWindow*)evt.GetEventObject();
|
||||
const wxSize sz = ctl->GetSize();
|
||||
|
||||
EVENT e; memset(&e, 0, sizeof(EVENT));
|
||||
e.type = E_CONTROL;
|
||||
e.v.ctl.id = evt.GetId();
|
||||
e.v.ctl.ci.type = sz.x > sz.y ? WC_HSCROLL : WC_VSCROLL;
|
||||
e.v.ctl.ci.win = (WINDOW)sb;
|
||||
e.v.ctl.ci.win = (WINDOW)ctl;
|
||||
e.v.ctl.ci.v.scroll.pos = evt.GetPosition();
|
||||
e.v.ctl.ci.v.scroll.what = sc;
|
||||
DoXvtEvent(e);
|
||||
@ -1109,18 +1111,3 @@ TTaskWin::~TTaskWin()
|
||||
}
|
||||
_nice_windows.Delete((WINDOW)this);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Pane interface
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
BOOLEAN xvt_win_add_pane(WINDOW win, WINDOW pane, const char* name, int dock, int flags)
|
||||
{
|
||||
BOOLEAN done = FALSE;
|
||||
if (win != NULL_WIN && pane != NULL_WIN && name && *name)
|
||||
{
|
||||
done = ((TwxWindow*)win)->AddPane((wxWindow*)pane, name, dock, flags);
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user