Patch level : 10.0
Files correlati : xvaga.dll Ricompilazione Demo : [ ] Commento : Supporto per controlli nativi trasparenti git-svn-id: svn://10.65.10.50/trunk@17381 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
b995405b2c
commit
bd28cd4d64
@ -4197,7 +4197,7 @@ WIN_TYPE xvt_vobj_get_type(WINDOW win)
|
||||
|
||||
BOOLEAN xvt_vobj_is_focusable(WINDOW win)
|
||||
{
|
||||
BOOLEAN ok = (win != NULL_WIN) && (win != PRINTER_WIN);
|
||||
BOOLEAN ok = win != NULL_WIN && win != PRINTER_WIN && xvt_vobj_is_valid(win);
|
||||
if (ok)
|
||||
{
|
||||
CAST_WIN(win, w);
|
||||
@ -4206,6 +4206,11 @@ BOOLEAN xvt_vobj_is_focusable(WINDOW win)
|
||||
return ok;
|
||||
}
|
||||
|
||||
BOOLEAN xvt_vobj_is_valid(WINDOW win)
|
||||
{
|
||||
return win != NULL_WIN && SafeCastWin(win) != NULL;
|
||||
}
|
||||
|
||||
void xvt_vobj_maximize(WINDOW win)
|
||||
{
|
||||
XVT_ASSERT(win != NULL_WIN && _task_win != NULL);
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "xvt_help.h"
|
||||
#include "xvt_menu.h"
|
||||
#include "xvt_type.h"
|
||||
#include "xvt_vers.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -403,6 +404,7 @@ XVTDLL WINDOW xvt_vobj_get_parent(WINDOW win);
|
||||
XVTDLL char* xvt_vobj_get_title(WINDOW win, char *title, int sz_title);
|
||||
XVTDLL WIN_TYPE xvt_vobj_get_type(WINDOW win);
|
||||
XVTDLL BOOLEAN xvt_vobj_is_focusable(WINDOW win);
|
||||
XVTDLL BOOLEAN xvt_vobj_is_valid(WINDOW win);
|
||||
XVTDLL void xvt_vobj_maximize(WINDOW win); // Added by XVAGA
|
||||
XVTDLL void xvt_vobj_minimize(WINDOW win); // Added by XVAGA
|
||||
XVTDLL void xvt_vobj_move(WINDOW win, const RCT* rctp);
|
||||
|
25
xvaga/xvt_vers.h
Executable file
25
xvaga/xvt_vers.h
Executable file
@ -0,0 +1,25 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 1989 - 2002 Providence Software Solutions, Inc. All rights reserved.
|
||||
* May be used only in accordance with a valid Source Code License
|
||||
* Agreement with Providence Software Solutions, Inc.
|
||||
*
|
||||
* $RCSfile: xvt_vers.h,v $
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* Purpose: XVT PTK version definitions.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef XVT_INCL_VERS
|
||||
#define XVT_INCL_VERS
|
||||
|
||||
#define XVT_PTK_VERSION_MAJOR 5
|
||||
#define XVT_PTK_VERSION_MINOR 6
|
||||
#define XVT_PTK_VERSION_PATCH 1
|
||||
|
||||
#define XVT_PTK_VERSION (XVT_MAKE_VERSION(XVT_PTK_VERSION_MAJOR,XVT_PTK_VERSION_MINOR,XVT_PTK_VERSION_PATCH))
|
||||
|
||||
#define XVT_CHECK_VERSION(vma,vmi,vpa) XVT_PTK_VERSION>=XVT_MAKE_VERSION(vma,vmi,vpa)
|
||||
|
||||
#endif /* XVT_INCL_VERS */
|
143
xvaga/xvtctl.cpp
143
xvaga/xvtctl.cpp
@ -116,7 +116,6 @@ class TwxTreeCtrl : public wxTreeCtrl
|
||||
WX_DECLARE_VOIDPTR_HASH_MAP(int, XVT_IMAGE_Map);
|
||||
XVT_IMAGE_Map m_img;
|
||||
|
||||
wxFont m_font;
|
||||
int m_nFrozen;
|
||||
|
||||
private:
|
||||
@ -134,9 +133,6 @@ protected:
|
||||
public:
|
||||
void SetNodeImages(const wxTreeItemId& id, XVT_IMAGE item_image,
|
||||
XVT_IMAGE collapsed_image, XVT_IMAGE expanded_image);
|
||||
virtual bool SetFont(const wxFont& font) { m_font = font; return font.IsOk(); }
|
||||
virtual wxFont GetFont() const;
|
||||
|
||||
void Suspend();
|
||||
void Resume();
|
||||
TwxTreeCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size);
|
||||
@ -155,6 +151,7 @@ class TwxOutlookBar : public wxVListBox
|
||||
TwxOutlookItem m_item[MAX_ITEMS];
|
||||
bool m_bCaptured;
|
||||
int m_nHovering;
|
||||
wxColour m_clrLite, m_clrDark;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
@ -168,11 +165,13 @@ protected:
|
||||
|
||||
public:
|
||||
int Add(short nIconId, const wxString strText, int nFlags);
|
||||
void SetColors(const XVT_COLOR_COMPONENT* colors);
|
||||
|
||||
TwxOutlookBar(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
|
||||
~TwxOutlookBar();
|
||||
};
|
||||
|
||||
WINDOW xvt_ctl_create_def(WIN_DEF *win_def_p, WINDOW parent_win, long app_data)
|
||||
WINDOW xvt_ctl_create_def(WIN_DEF* win_def_p, WINDOW parent_win, long app_data)
|
||||
{
|
||||
wxASSERT(win_def_p != NULL);
|
||||
const wxRect rct = NormalizeRCT(&win_def_p->rct);
|
||||
@ -248,14 +247,6 @@ WINDOW xvt_ctl_create_def(WIN_DEF *win_def_p, WINDOW parent_win, long app_data)
|
||||
{
|
||||
TwxTreeCtrl* tv = new TwxTreeCtrl(pParent, id, rct.GetPosition(), rct.GetSize());
|
||||
win = (WINDOW)tv;
|
||||
XVT_FNTID font_id = win_def_p->v.ctl.font_id;
|
||||
if (font_id == NULL)
|
||||
font_id = xvt_dwin_get_font(parent_win);
|
||||
if (font_id != NULL)
|
||||
{
|
||||
const wxFont& font = ((TFontId*)font_id)->Font(NULL, win);
|
||||
tv->SetFont(font);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WC_OUTLOOKBAR:
|
||||
@ -263,14 +254,7 @@ WINDOW xvt_ctl_create_def(WIN_DEF *win_def_p, WINDOW parent_win, long app_data)
|
||||
long style = 0;
|
||||
TwxOutlookBar* tob = new TwxOutlookBar(pParent, id, rct.GetPosition(), rct.GetSize(), style);
|
||||
win = (WINDOW)tob;
|
||||
XVT_FNTID font_id = win_def_p->v.ctl.font_id;
|
||||
if (font_id == NULL)
|
||||
font_id = xvt_dwin_get_font(parent_win);
|
||||
if (font_id != NULL)
|
||||
{
|
||||
const wxFont& font = ((TFontId*)font_id)->Font(NULL, win);
|
||||
tob->SetFont(font);
|
||||
}
|
||||
tob->SetColors(win_def_p->ctlcolors);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -279,10 +263,44 @@ WINDOW xvt_ctl_create_def(WIN_DEF *win_def_p, WINDOW parent_win, long app_data)
|
||||
|
||||
if (win != NULL)
|
||||
{
|
||||
wxWindow& w = *(wxWindow*)win;
|
||||
wxWindow& w = *wxStaticCast((wxObject*)win, wxWindow);
|
||||
const long flags = win_def_p->v.ctl.flags;
|
||||
if (flags & CTL_FLAG_INVISIBLE) w.Hide();
|
||||
if (flags & CTL_FLAG_DISABLED) w.Disable();
|
||||
|
||||
XVT_FNTID font_id = win_def_p->v.ctl.font_id;
|
||||
if (font_id == NULL)
|
||||
font_id = xvt_dwin_get_font(parent_win);
|
||||
if (font_id != NULL)
|
||||
{
|
||||
const wxFont& font = ((TFontId*)font_id)->Font(NULL, win);
|
||||
w.SetFont(font);
|
||||
}
|
||||
|
||||
// Cerco l'eventuale colore dello sfondo del controllo
|
||||
const XVT_COLOR_COMPONENT* xcc = win_def_p->ctlcolors;
|
||||
if (xcc != NULL)
|
||||
{
|
||||
for (int c = 0; xcc[c].type != XVT_COLOR_NULL; c++)
|
||||
{
|
||||
CAST_COLOR(xcc[c].color, rgb);
|
||||
switch (xcc[c].type)
|
||||
{
|
||||
case XVT_COLOR_FOREGROUND:
|
||||
w.SetForegroundColour(rgb);
|
||||
break;
|
||||
case XVT_COLOR_BACKGROUND:
|
||||
if (win_def_p->wtype == WC_PUSHBUTTON)
|
||||
w.SetBackgroundColour(rgb);
|
||||
break;
|
||||
case XVT_COLOR_BLEND:
|
||||
if (win_def_p->wtype != WC_PUSHBUTTON)
|
||||
w.SetBackgroundColour(rgb);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return win;
|
||||
@ -885,11 +903,6 @@ void TwxTreeCtrl::SetNodeImages(const wxTreeItemId& id, XVT_IMAGE item_image,
|
||||
}
|
||||
}
|
||||
|
||||
wxFont TwxTreeCtrl::GetFont() const
|
||||
{
|
||||
return m_font.IsOk() ? m_font : wxTreeCtrl::GetFont();
|
||||
}
|
||||
|
||||
void TwxTreeCtrl::Suspend()
|
||||
{ m_nFrozen++; }
|
||||
|
||||
@ -1167,6 +1180,7 @@ BEGIN_EVENT_TABLE(TwxOutlookBar, wxVListBox)
|
||||
EVT_MOUSE_CAPTURE_LOST(TwxOutlookBar::OnMouseCaptureLost)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
/*
|
||||
static wxAuiDockArt* GetArtist(const wxWindow* pWindow)
|
||||
{
|
||||
wxAuiDockArt* pArtist = NULL;
|
||||
@ -1175,6 +1189,7 @@ static wxAuiDockArt* GetArtist(const wxWindow* pWindow)
|
||||
pArtist = pManager->GetArtProvider();
|
||||
return pArtist;
|
||||
}
|
||||
*/
|
||||
|
||||
static const wxColour ModulateColour(const wxColour& col, int percent)
|
||||
{
|
||||
@ -1190,11 +1205,12 @@ static const wxColour ModulateColour(const wxColour& col, int percent)
|
||||
return wxColour(r, g, b);
|
||||
}
|
||||
|
||||
static wxColour DarkerColor(const wxColour& col, int percent = 20)
|
||||
{ return ModulateColour(col, -percent); }
|
||||
|
||||
static wxColour LighterColor(const wxColour& col, int percent = 20)
|
||||
{ return ModulateColour(col, +percent); }
|
||||
static const wxColour MeanColour(const wxColour& c1, const wxColour& c2, int percent = 50)
|
||||
{
|
||||
const double p = percent / 100.0;
|
||||
const double i = 1.0-p;
|
||||
return wxColour(c1.Red()*i+c2.Red()*p, c1.Green()*i+c2.Green()*p, c1.Blue()*i+c2.Blue()*p);
|
||||
}
|
||||
|
||||
void TwxOutlookBar::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const
|
||||
{
|
||||
@ -1221,8 +1237,8 @@ void TwxOutlookBar::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) con
|
||||
}
|
||||
else
|
||||
{
|
||||
color1 = LighterColor(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION));
|
||||
color2 = DarkerColor(wxSystemSettings::GetColour(wxSYS_COLOUR_ACTIVECAPTION));
|
||||
color1 = m_clrLite;
|
||||
color2 = m_clrDark;
|
||||
}
|
||||
}
|
||||
dc.GradientFillLinear(rect, color1, color2, wxDOWN);
|
||||
@ -1342,12 +1358,71 @@ int TwxOutlookBar::Add(short nIconId, const wxString strText, int nFlags)
|
||||
return i;
|
||||
}
|
||||
|
||||
static bool AreSystemColors(const XVT_COLOR_COMPONENT* colors)
|
||||
{
|
||||
bool yes = true;
|
||||
if (colors != NULL && colors->type != 0)
|
||||
{
|
||||
XVT_COLOR_COMPONENT* cc = (XVT_COLOR_COMPONENT*)xvt_vobj_get_attr(NULL_WIN, ATTR_APP_CTL_COLORS);
|
||||
for (int i = 0; colors[i].type && yes; i++)
|
||||
{
|
||||
for (int j = 0; cc[j].type; j++)
|
||||
{
|
||||
if (colors[i].type == cc[j].type)
|
||||
{
|
||||
yes = colors[i].color == cc[j].color;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
xvt_mem_free((DATA_PTR)cc);
|
||||
}
|
||||
return yes;
|
||||
}
|
||||
|
||||
void TwxOutlookBar::SetColors(const XVT_COLOR_COMPONENT* colors)
|
||||
{
|
||||
if (AreSystemColors(colors))
|
||||
{
|
||||
m_clrLite = ModulateColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION), +20);
|
||||
m_clrDark = ModulateColour(wxSystemSettings::GetColour(wxSYS_COLOUR_ACTIVECAPTION), -20);
|
||||
}
|
||||
else
|
||||
{
|
||||
int nFound = 0;
|
||||
wxColour lite, dark, back;
|
||||
for (int c = 0; colors[c].type; c++)
|
||||
{
|
||||
CAST_COLOR(colors[c].color, rgb);
|
||||
switch(colors[c].type)
|
||||
{
|
||||
case XVT_COLOR_BLEND : lite = rgb; nFound |= 1; break;
|
||||
case XVT_COLOR_BORDER : dark = rgb; nFound |= 2; break;
|
||||
case XVT_COLOR_BACKGROUND : back = rgb; nFound |= 4; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
switch (nFound)
|
||||
{
|
||||
case 0x1: m_clrLite = lite; m_clrDark = ModulateColour(lite, -40); break;
|
||||
case 0x2: m_clrLite = ModulateColour(dark, 40); m_clrDark = dark; break;
|
||||
case 0x3: m_clrLite = lite; m_clrDark = dark; break;
|
||||
case 0x4: m_clrLite = ModulateColour(back, 20); m_clrDark = ModulateColour(back, -20); break;
|
||||
case 0x5: m_clrLite = MeanColour(back, lite); m_clrDark = ModulateColour(back, -20); break;
|
||||
case 0x6: m_clrLite = ModulateColour(back, 20); m_clrDark = MeanColour(back, dark); break;
|
||||
case 0x7: m_clrLite = MeanColour(back, lite); m_clrDark = MeanColour(back, dark); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TwxOutlookBar::TwxOutlookBar(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size, long style)
|
||||
: wxVListBox(parent, id, pos, size, style),
|
||||
m_bCaptured(false), m_nHovering(wxNOT_FOUND)
|
||||
{
|
||||
SetItemCount(0);
|
||||
SetColors(NULL); // Set default colors
|
||||
}
|
||||
|
||||
TwxOutlookBar::~TwxOutlookBar()
|
||||
|
Loading…
x
Reference in New Issue
Block a user