Patch level : 12.0 1204

Files correlati     : cg2.exe ve0.exe xvaga.dll

Commento:
aggiunti campi per  memorizzare documenti generici e documenti cartacei da archiviare

Aggiunte
xvt_toolbar_toggle_control
xvt_toolbar_set_image
This commit is contained in:
Alessandro Bonazzi 2022-10-07 14:26:16 +02:00
parent aec7d0d669
commit 393bb40547
2 changed files with 49 additions and 1 deletions

View File

@ -49,6 +49,8 @@ XVTDLL void xvt_toolbar_realize(WINDOW win);
XVTDLL BOOLEAN xvt_toolbar_remove_control(WINDOW win, int cid);
XVTDLL BOOLEAN xvt_toolbar_set_last_tool(WINDOW win, int cid);
XVTDLL void xvt_toolbar_show_control(WINDOW win, int cid, BOOLEAN on);
XVTDLL BOOLEAN xvt_toolbar_toggle_control(WINDOW win, int cid, BOOLEAN on);
XVTDLL BOOLEAN xvt_toolbar_set_image(WINDOW win, int cid, int ico);
#if defined(_cplusplus) || defined(__cplusplus)
} /* extern "C" */

View File

@ -2470,6 +2470,7 @@ public:
int ico() const { return _ico; }
void set_pos(short pos) { _pos = pos; }
void set_ico(short ico) { _ico = ico; }
wxToolData(int ico, short pos = -1) : _pos(pos), _ico(ico) {}
};
@ -2615,7 +2616,7 @@ static TwxToolBar* Win2Bar(WINDOW win)
return wxDynamicCast((wxObject*)win, TwxToolBar);
}
BOOLEAN xvt_toolbar_add_control(WINDOW win, int cid, TOOL_TYPE type, const char *title,
BOOLEAN xvt_toolbar_add_control(WINDOW win, int cid, TOOL_TYPE type, const char *title,
int ico, int WXUNUSED(cust_width), int idx)
{
BOOLEAN ok = false;
@ -2641,6 +2642,7 @@ BOOLEAN xvt_toolbar_add_control(WINDOW win, int cid, TOOL_TYPE type, const char
const wxBitmap bmp = xvtart_GetToolResource(ico, tb.GetToolBitmapSize().y);
wxString cap, tip;
wxChar acc = 0;
for (const char* t = title; *t; t++)
{
if (*t == '~' || *t == '&')
@ -2876,10 +2878,54 @@ BOOLEAN xvt_toolbar_remove_control(WINDOW win, int cid)
return ok;
}
BOOLEAN xvt_toolbar_toggle_control(WINDOW win, int cid, BOOLEAN on)
{
TwxToolBar* ptb = Win2Bar(win);
bool ok = ptb != nullptr;
if (ok)
{
TwxToolBar& tb = *ptb;
int size = tb.GetToolBitmapSize().y;
int idx = tb.GetToolPos(cid);
tb.ToggleTool(cid, on);
xvt_toolbar_realize(win);
tb.Refresh();
}
return ok;
}
BOOLEAN xvt_toolbar_set_image(WINDOW win, int cid, int ico)
{
TwxToolBar* ptb = Win2Bar(win);
bool ok = ptb != nullptr;
if (ok) // non si capisce perchè non debba aggiornare le bitmap
{
TwxToolBar& tb = *ptb;
int size = tb.GetToolBitmapSize().y;
int idx = ptb->GetToolPos(cid);
wxToolBarToolBase* tool = tb.RemoveTool(cid);
ok = tool != nullptr;
if (ok)
{
wxString label = tool->GetLabel();
delete tool;
ok = xvt_toolbar_add_control(win, cid, TOOL_BUTTON, label.c_str(), ico, size, idx);
}
if (ok)
xvt_toolbar_realize(win);
}
return ok;
}
void xvt_dwin_draw_tool(WINDOW win, int x, int y, int rid, int size)
{
const wxBitmap bmp = xvtart_GetToolResource(rid, size);
if (bmp.IsOk())
{
wxDC& dc = GetTDCMapper().GetDC(win);