Patch level : 10.0

Files correlati     : xvaga
Ricompilazione Demo : [ ]
Commento            :
Aggiunta gestione processi "figli"
Corretta gestione alberi con icone grandi


git-svn-id: svn://10.65.10.50/trunk@16082 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-02-01 16:38:06 +00:00
parent b3bfc3c1d8
commit cc70a2d1c7
7 changed files with 188 additions and 63 deletions

View File

@ -137,7 +137,7 @@ int FamilySorter(const void* p1,const void* p2)
{ {
const char* s1 = *(const char**)p1; const char* s1 = *(const char**)p1;
const char* s2 = *(const char**)p2; const char* s2 = *(const char**)p2;
return strcmp(s1, s2); return wxStricmp(s1, s2);
} }
int OsWin32_EnumerateFamilies(WXHDC hDC, char** families, int max_count) int OsWin32_EnumerateFamilies(WXHDC hDC, char** families, int max_count)
@ -168,7 +168,7 @@ int OsWin32_EnumerateSizes(WXHDC hDC, const char* name, long* sizes, short* scal
void* OsWin32_GetPrinterInfo(int& size, const char* printer) void* OsWin32_GetPrinterInfo(int& size, const char* printer)
{ {
char name[256]; char name[_MAX_PATH];
size = 0; size = 0;
if (printer == NULL || *printer == '\0') if (printer == NULL || *printer == '\0')
@ -507,12 +507,12 @@ static BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
if (w->_instance != NULL) if (w->_instance != NULL)
{ {
// Cerco di capire se e' la finetra principale dal fatto che
// abbia la caption ed i bottoni di chiusura
const DWORD dwWanted = WS_CAPTION | WS_SYSMENU;
HINSTANCE inst = (HINSTANCE)::GetWindowLong(hwnd, GWL_HINSTANCE); HINSTANCE inst = (HINSTANCE)::GetWindowLong(hwnd, GWL_HINSTANCE);
if (inst == w->_instance) if (inst == w->_instance)
{ {
// Cerco di capire se e' la finetra principale dal fatto che
// abbia la caption ed i bottoni di chiusura
const DWORD dwWanted = WS_CAPTION | WS_SYSMENU;
const DWORD style = ::GetWindowLong(hwnd, GWL_STYLE); const DWORD style = ::GetWindowLong(hwnd, GWL_STYLE);
if ((style & dwWanted) == dwWanted) if ((style & dwWanted) == dwWanted)
{ {
@ -599,6 +599,7 @@ static BOOL CALLBACK EnumCampoWindowsProc(HWND hwnd, LPARAM lParam)
return TRUE; return TRUE;
} }
unsigned int OsWin32_FindMenuContainer() unsigned int OsWin32_FindMenuContainer()
{ {
TFindWindowInfo w; TFindWindowInfo w;
@ -607,6 +608,18 @@ unsigned int OsWin32_FindMenuContainer()
return (unsigned int)w._hwnd; return (unsigned int)w._hwnd;
} }
static BOOL CALLBACK CloseChildrenProc(HWND hwnd, LPARAM lParam)
{
::PostMessage(hwnd, WM_CLOSE, 0, 0);
return TRUE;
}
long OsWin32_CloseChildren(unsigned int parent)
{
::EnumChildWindows((HWND)parent, CloseChildrenProc, parent);
return 1;
}
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Hardlock Support // Hardlock Support
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -723,13 +736,13 @@ bool OsWin32_SL_WriteBlock(unsigned short reg, unsigned short size, const unsign
static long GetRegistryString(HKEY key, const char* subkey, wxString& retstr) static long GetRegistryString(HKEY key, const char* subkey, wxString& retstr)
{ {
HKEY hkey; HKEY hkey;
long retval = RegOpenKey(key, subkey, &hkey); long retval = ::RegOpenKey(key, subkey, &hkey);
if (retval == ERROR_SUCCESS) if (retval == ERROR_SUCCESS)
{ {
char retdata[_MAX_PATH]; char retdata[_MAX_PATH];
long datasize = sizeof(retdata); long datasize = sizeof(retdata);
RegQueryValue(hkey, NULL, retdata, &datasize); ::RegQueryValue(hkey, NULL, retdata, &datasize);
RegCloseKey(hkey); ::RegCloseKey(hkey);
retstr = retdata; retstr = retdata;
} }
return retval; return retval;
@ -751,12 +764,12 @@ wxString OsWin32_File2App(const char* filename)
if (app.IsEmpty()) if (app.IsEmpty())
{ {
char ext[_MAX_EXT]; wxString ext;
if (*filename == '.') if (*filename == '.')
strcpy(ext, filename); ext = filename;
else else
_splitpath(filename, NULL, NULL, NULL, ext); wxSplitPath(filename, NULL, NULL, &ext);
_strlwr(ext); ext.MakeLower();
wxString key; wxString key;
if (GetRegistryString(HKEY_CLASSES_ROOT, ext, key) == ERROR_SUCCESS) if (GetRegistryString(HKEY_CLASSES_ROOT, ext, key) == ERROR_SUCCESS)
@ -779,18 +792,16 @@ wxString OsWin32_File2App(const char* filename)
static bool IsInternetAddress(const char* filename) static bool IsInternetAddress(const char* filename)
{ {
const wxString url(filename); wxString url(filename); url.MakeLower();
if (url.StartsWith("http:") || url.StartsWith("ftp:")) if (url.StartsWith("http:") || url.StartsWith("ftp:"))
return TRUE; return true;
if (url.Find("www.") >= 0) if (url.Find("www.") >= 0)
return TRUE; return true;
char ext[_MAX_EXT]; wxString ext; wxFileName::SplitPath(url, NULL, NULL, NULL, &ext);
_splitpath(filename, NULL, NULL, NULL, ext);
_strlwr(ext);
const char* const extensions[] = { "com","edu","gov","it","mil","net","org", NULL }; const char* const extensions[] = { "com","edu","gov","it","mil","net","org", NULL };
for (int e = 0; extensions[e]; e++) for (int e = 0; extensions[e]; e++)
if (wxStricmp(ext, extensions[e]) == 0) if (ext == extensions[e])
return true; return true;
return false; return false;
@ -801,25 +812,25 @@ unsigned int OsWin32_LoadIcon(const char* filename)
unsigned int icon = 0; unsigned int icon = 0;
int icon_number = 0; int icon_number = 0;
char ext[_MAX_EXT]; wxString ext;
if (*filename == '.' && strlen(filename) < _MAX_EXT) if (*filename == '.' && strlen(filename) < _MAX_EXT)
strcpy(ext, filename); ext = filename;
else else
{ {
if (IsInternetAddress(filename)) if (IsInternetAddress(filename))
strcpy(ext, ".htm"); ext = ".htm";
else else
_splitpath(filename, NULL, NULL, NULL, ext); wxFileName::SplitPath(filename, NULL, NULL, NULL, &ext);
} }
_strlwr(ext); ext.MakeLower();
wxString key; wxString key;
if (ext != ".exe") if (ext != ".exe")
{ {
if (GetRegistryString(HKEY_CLASSES_ROOT, ext, key) == ERROR_SUCCESS) if (::GetRegistryString(HKEY_CLASSES_ROOT, ext, key) == ERROR_SUCCESS)
{ {
key << "\\DefaultIcon"; key << "\\DefaultIcon";
if (GetRegistryString(HKEY_CLASSES_ROOT, key, key) == ERROR_SUCCESS) // Windows 95 only if (::GetRegistryString(HKEY_CLASSES_ROOT, key, key) == ERROR_SUCCESS) // Windows 95 only
{ {
const int comma = key.find(','); const int comma = key.find(',');
if (comma > 0) if (comma > 0)
@ -958,17 +969,22 @@ typedef BOOL (PASCAL *pfnProcessIdToSessionId)(DWORD dwProcessId,DWORD* pSession
int OsWin32_GetSessionId() int OsWin32_GetSessionId()
{ {
//modifiche del 5/4/04 per poter gestire le licenze con win2000/2003 server edition
DWORD session = 0; DWORD session = 0;
HMODULE kernel = GetModuleHandle("kernel32.dll");
#if _MSC_VER >= 1300
//modifiche del 1/2/08 per poter gestire le licenze con win2000/2003/2008 server edition
::ProcessIdToSessionId(GetCurrentProcessId(), &session);
#else
//modifiche del 5/4/04 per poter gestire le licenze con win2000/2003 server edition
HMODULE kernel = GetModuleHandle("kernel32.dll");
if (kernel != NULL) if (kernel != NULL)
{ {
pfnProcessIdToSessionId fn = (pfnProcessIdToSessionId)GetProcAddress(kernel, "ProcessIdToSessionId"); pfnProcessIdToSessionId fn = (pfnProcessIdToSessionId)GetProcAddress(kernel, "ProcessIdToSessionId");
if (fn != NULL) if (fn != NULL)
fn(GetCurrentProcessId(), &session); fn(GetCurrentProcessId(), &session);
} }
return (int) session; #endif
return (int)session;
} }
//definito il valore della variabile intera SM_REMOTESESSION //definito il valore della variabile intera SM_REMOTESESSION

View File

@ -17,6 +17,8 @@ void* OsWin32_GetPrinterInfo(int& size, const char* printer);
void OsWin32_PlaceProcessInWindow(unsigned int instance, const char* name, unsigned int parent); void OsWin32_PlaceProcessInWindow(unsigned int instance, const char* name, unsigned int parent);
unsigned int OsWin32_FindMenuContainer(); unsigned int OsWin32_FindMenuContainer();
long OsWin32_CloseChildren(unsigned int parent);
void OsWin32_UpdateWindow(unsigned int handle); void OsWin32_UpdateWindow(unsigned int handle);
int OsWin32_Help(WXHWND handle, const char* hlp, unsigned int cmd, const char* topic); int OsWin32_Help(WXHWND handle, const char* hlp, unsigned int cmd, const char* topic);

View File

@ -144,7 +144,7 @@ wxString GetResourceName(const char* type, int rid)
return strName; return strName;
} }
wxIcon* _GetIconResource(int rid) const wxIcon* _GetIconResource(int rid)
{ {
wxIcon* icon = (wxIcon*)_nice_icons.Get(rid); wxIcon* icon = (wxIcon*)_nice_icons.Get(rid);
if (icon == NULL) if (icon == NULL)
@ -303,13 +303,14 @@ void xvt_app_create(int argc, char **argv, unsigned long flags,
wxPoint pos = wxDefaultPosition; wxPoint pos = wxDefaultPosition;
wxSize size = wxDefaultSize; wxSize size = wxDefaultSize;
long style = wxDEFAULT_FRAME_STYLE - wxRESIZE_BORDER; long style = wxDEFAULT_FRAME_STYLE;
#ifdef WIN32 #ifdef WIN32
HWND hwndParent = (HWND)OsWin32_FindMenuContainer(); HWND hwndParent = (HWND)OsWin32_FindMenuContainer();
if (hwndParent != NULL) if (hwndParent != NULL)
{ {
RECT rct; ::GetWindowRect(hwndParent, &rct); style &= ~wxRESIZE_BORDER;
RECT rct; ::GetClientRect(hwndParent, &rct);
if (rct.right - rct.left >= 720) if (rct.right - rct.left >= 720)
xvt_rect_set(&_startup_rect, rct.left, rct.top, rct.right, rct.bottom); xvt_rect_set(&_startup_rect, rct.left, rct.top, rct.right, rct.bottom);
} }
@ -344,7 +345,8 @@ void xvt_app_create(int argc, char **argv, unsigned long flags,
if (hwndParent != NULL) if (hwndParent != NULL)
{ {
HWND hwndChild = (HWND)_task_win->GetHandle(); HWND hwndChild = (HWND)_task_win->GetHandle();
::SetWindowPos(hwndChild, HWND_TOPMOST, pos.x, pos.y, size.x, size.y, SWP_NOMOVE|SWP_NOSIZE); //::SetWindowPos(hwndChild, HWND_TOPMOST, pos.x, pos.y, size.x, size.y, SWP_NOMOVE|SWP_NOSIZE);
::SetParent(hwndChild, hwndParent);
} }
#endif #endif
@ -1277,7 +1279,7 @@ void xvt_dwin_draw_gradient_linear(WINDOW win, const RCT* r, COLOR col1, COLOR c
void xvt_dwin_draw_icon(WINDOW win, int x, int y, int rid) void xvt_dwin_draw_icon(WINDOW win, int x, int y, int rid)
{ {
wxIcon* ico = _GetIconResource(rid); const wxIcon* ico = _GetIconResource(rid);
if (ico != NULL) if (ico != NULL)
{ {
CAST_DC(win, dc); CAST_DC(win, dc);
@ -3407,6 +3409,16 @@ long xvt_sys_execute_in_window(const char* cmdline, WINDOW win)
return inst; return inst;
} }
long xvt_sys_close_children(WINDOW win)
{
long c = 0;
#ifdef WIN32
CAST_WIN(win, w);
c = OsWin32_CloseChildren((unsigned int)w.GetHandle());
#endif
return c;
}
BOOLEAN xvt_sys_goto_url(const char* url, const char* action) BOOLEAN xvt_sys_goto_url(const char* url, const char* action)
{ {
#ifdef WIN32 #ifdef WIN32
@ -4270,11 +4282,13 @@ WINDOW statbar_create(int cid, int left, int top, int right, int bottom,
{ {
XVT_ASSERT(parent_win == TASK_WIN); XVT_ASSERT(parent_win == TASK_WIN);
wxFrame& w = *(wxFrame*)_task_win; wxFrame& w = *(wxFrame*)_task_win;
wxStatusBar* pStatusBar = w.CreateStatusBar(2, 0); // NOT w.CreateStatusBar(2, wxST_SIZEGRIP)
const int nStyle = 0; // not wxST_SIZEGRIP
wxStatusBar* pStatusBar = w.CreateStatusBar(2, nStyle);
if (pStatusBar != NULL) if (pStatusBar != NULL)
{ {
const wxSize sz = pStatusBar->GetSize(); const wxSize sz = pStatusBar->GetSize();
const int widths[2] = { -1, 256 }; const int widths[2] = { -1, 320 };
pStatusBar->SetStatusWidths(2, widths); pStatusBar->SetStatusWidths(2, widths);
} }
return (WINDOW)pStatusBar; return (WINDOW)pStatusBar;

View File

@ -355,6 +355,8 @@ XVTDLL BOOLEAN xvt_chr_is_alnum(int c);
XVTDLL void xvt_sys_beep(int severity); XVTDLL void xvt_sys_beep(int severity);
XVTDLL long xvt_sys_execute(const char* cmdline, BOOLEAN sync, BOOLEAN iconizetask); XVTDLL long xvt_sys_execute(const char* cmdline, BOOLEAN sync, BOOLEAN iconizetask);
XVTDLL long xvt_sys_execute_in_window(const char* cmdline, WINDOW win); XVTDLL long xvt_sys_execute_in_window(const char* cmdline, WINDOW win);
XVTDLL long xvt_sys_close_children(WINDOW win);
XVTDLL BOOLEAN xvt_sys_get_host_name(char* name, int maxlen); XVTDLL BOOLEAN xvt_sys_get_host_name(char* name, int maxlen);
XVTDLL BOOLEAN xvt_sys_get_user_name(char* name, int maxlen); XVTDLL BOOLEAN xvt_sys_get_user_name(char* name, int maxlen);
XVTDLL BOOLEAN xvt_sys_goto_url(const char* url, const char* action); XVTDLL BOOLEAN xvt_sys_goto_url(const char* url, const char* action);

View File

@ -560,7 +560,6 @@ long xvt_fmap_get_families(PRINT_RCD *precp, char **family_array, long max_famil
return size; return size;
} }
void xvt_print_close(void) void xvt_print_close(void)
{ {
// Nothing to do ? // Nothing to do ?

View File

@ -1093,7 +1093,7 @@ TTaskWin::TTaskWin(wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, long style) const wxPoint& pos, const wxSize& size, long style)
: wxFrame(NULL, id, title, pos, size, style), m_menu(NULL), m_pOldBar(NULL), m_MenuOwner(NULL) : wxFrame(NULL, id, title, pos, size, style), m_menu(NULL), m_pOldBar(NULL), m_MenuOwner(NULL)
{ {
wxIcon* ico = _GetIconResource(ICON_RSRC); const wxIcon* ico = _GetIconResource(ICON_RSRC);
if (ico) if (ico)
SetIcon(*ico); SetIcon(*ico);
_nice_windows.Put((WINDOW)this, this); _nice_windows.Put((WINDOW)this, this);
@ -1179,13 +1179,16 @@ class TwxOutlookBar : public wxVListBox
{ {
enum { MAX_ITEMS = 32 }; enum { MAX_ITEMS = 32 };
TwxOutlookItem m_item[MAX_ITEMS]; TwxOutlookItem m_item[MAX_ITEMS];
bool m_bCaptured;
int m_nHovering;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
protected: protected:
virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const; virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const;
virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const; virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const;
virtual wxCoord OnMeasureItem(size_t n) const; virtual wxCoord OnMeasureItem(size_t n) const;
virtual void OnMouseMove(wxMouseEvent& e);
virtual void OnMouseCaptureLost(wxMouseCaptureLostEvent& e);
virtual void OnSelected(wxCommandEvent& e); virtual void OnSelected(wxCommandEvent& e);
public: public:
@ -1545,6 +1548,22 @@ int TwxTreeCtrl::img2int(XVT_IMAGE xvt_img)
il->Create(img.GetWidth(), img.GetHeight(), true, 3); il->Create(img.GetWidth(), img.GetHeight(), true, 3);
AssignImageList(il); // DON'T CALL SetImageList! AssignImageList(il); // DON'T CALL SetImageList!
} }
else
{
int w, h; il->GetSize(0, w, h);
if (img.GetWidth() > w) // L'immagine nuova e' troppo grande?
{
wxImageList* nil = new wxImageList;
nil->Create(img.GetWidth(), img.GetHeight(), true, 3);
for (int k = 0; k < il->GetImageCount(); k++)
{
wxImage old = il->GetBitmap(k).ConvertToImage();
old.Rescale(img.GetWidth(), img.GetHeight(), wxIMAGE_QUALITY_HIGH);
nil->Add(old);
}
AssignImageList(il = nil);
}
}
i = il->Add(wxBitmap(img)); i = il->Add(wxBitmap(img));
#if wxCHECK_VERSION(2,8,7) #if wxCHECK_VERSION(2,8,7)
m_img[xvt_img] = i+1; // Memorizzo indice+1 m_img[xvt_img] = i+1; // Memorizzo indice+1
@ -1810,6 +1829,11 @@ void xvt_treeview_suspend(WINDOW win)
BEGIN_EVENT_TABLE(TwxOutlookBar, wxVListBox) BEGIN_EVENT_TABLE(TwxOutlookBar, wxVListBox)
EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LISTBOX_SELECTED, TwxOutlookBar::OnSelected) EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LISTBOX_SELECTED, TwxOutlookBar::OnSelected)
EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, TwxOutlookBar::OnSelected) EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, TwxOutlookBar::OnSelected)
EVT_MOTION(TwxOutlookBar::OnMouseMove)
#if wxCHECK_VERSION(2,8,7)
EVT_MOUSE_CAPTURE_LOST(TwxOutlookBar::OnMouseCaptureLost)
#endif
END_EVENT_TABLE() END_EVENT_TABLE()
static wxAuiDockArt* GetArtist(const wxWindow* pWindow) static wxAuiDockArt* GetArtist(const wxWindow* pWindow)
@ -1821,29 +1845,53 @@ static wxAuiDockArt* GetArtist(const wxWindow* pWindow)
return pArtist; return pArtist;
} }
static int GrayLevel(const wxColour& col) static const wxColour ModulateColour(const wxColour& col, int percent)
{ {
const unsigned char r = col.Red(); int k = 0;
const unsigned char g = col.Green(); if (percent > 0)
const unsigned char b = col.Blue(); k = 255;
int k = (int)(0.299 * r + 0.587 * g + 0.114 * b); else
return k; percent = -percent;
int r = ((k * percent) + (col.Red() * (100-percent))) / 100;
int g = ((k * percent) + (col.Green() * (100-percent))) / 100;
int b = ((k * percent) + (col.Blue() * (100-percent))) / 100;
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); }
void TwxOutlookBar::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const void TwxOutlookBar::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const
{ {
wxAuiDockArt* pArtist = GetArtist(this);
wxColour color1, color2; wxColour color1, color2;
if (n == GetSelection()) if (n == m_nHovering)
{ {
color1 = wxColour(251,230,148); // Colori predefiniti di Outlook if (n == GetSelection())
color2 = wxColour(238,149, 21); {
color1 = wxColour(232,127,8);
color2 = wxColour(247,218,124);
}
else
{
color1 = wxColour(255,255,220);
color2 = wxColour(247,192,91);
}
} }
else else
{ {
color1 = pArtist->GetColour(wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR); if (n == GetSelection())
color2 = pArtist->GetColour(wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR); {
color1 = wxColour(251,230,148); // Colori predefiniti di Outlook
color2 = wxColour(238,149, 21);
}
else
{
color1 = LighterColor(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION));
color2 = DarkerColor(wxSystemSettings::GetColour(wxSYS_COLOUR_ACTIVECAPTION));
}
} }
dc.GradientFillLinear(rect, color1, color2, wxDOWN); dc.GradientFillLinear(rect, color1, color2, wxDOWN);
} }
@ -1855,7 +1903,7 @@ void TwxOutlookBar::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const
int nTextOffset = 4; int nTextOffset = 4;
if (oi.m_nIconId > 0) if (oi.m_nIconId > 0)
{ {
wxIcon* pIcon = _GetIconResource(oi.m_nIconId); const wxIcon* pIcon = _GetIconResource(oi.m_nIconId);
if (pIcon != NULL) if (pIcon != NULL)
{ {
const wxSize szIco(pIcon->GetWidth(), pIcon->GetHeight()); const wxSize szIco(pIcon->GetWidth(), pIcon->GetHeight());
@ -1864,16 +1912,11 @@ void TwxOutlookBar::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const
} }
} }
wxAuiDockArt* pArtist = GetArtist(this); wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
wxFont font = pArtist->GetFont(wxAUI_DOCKART_CAPTION_FONT);
font.SetWeight(wxFONTWEIGHT_BOLD); font.SetWeight(wxFONTWEIGHT_BOLD);
dc.SetFont(font); dc.SetFont(font);
wxColour color; wxColour color = wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT);
if (n == GetSelection())
color = pArtist->GetColour(wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR );
else
color = pArtist->GetColour(wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR );
dc.SetTextForeground(color); dc.SetTextForeground(color);
const wxSize szText = dc.GetTextExtent(oi.m_strText); const wxSize szText = dc.GetTextExtent(oi.m_strText);
@ -1892,6 +1935,55 @@ wxCoord TwxOutlookBar::OnMeasureItem(size_t n) const
return nHeight; return nHeight;
} }
void TwxOutlookBar::OnMouseMove(wxMouseEvent& evt)
{
int nHover = HitTest(evt.GetPosition());
if (m_bCaptured && nHover != wxNOT_FOUND)
{
const wxRect rect = GetClientRect();
if (!rect.Contains(evt.GetPosition()))
nHover = wxNOT_FOUND;
}
if (nHover == wxNOT_FOUND)
{
if (m_bCaptured)
{
m_bCaptured = false;
ReleaseMouse();
}
}
else
{
if (!m_bCaptured)
{
m_bCaptured = true;
CaptureMouse();
}
}
if (nHover != m_nHovering)
{
const int nWasHovering = m_nHovering;
m_nHovering = nHover;
if (nWasHovering != wxNOT_FOUND)
RefreshLine(nWasHovering);
if (m_nHovering != wxNOT_FOUND)
RefreshLine(m_nHovering);
}
}
void TwxOutlookBar::OnMouseCaptureLost(wxMouseCaptureLostEvent&)
{
m_bCaptured = false;
if (m_nHovering != wxNOT_FOUND)
{
const int nWasHovering = m_nHovering;
m_nHovering = wxNOT_FOUND;
RefreshLine(nWasHovering);
}
}
void TwxOutlookBar::OnSelected(wxCommandEvent& evt) void TwxOutlookBar::OnSelected(wxCommandEvent& evt)
{ {
EVENT e; memset(&e, 0, sizeof(EVENT)); EVENT e; memset(&e, 0, sizeof(EVENT));
@ -1921,7 +2013,7 @@ int TwxOutlookBar::Add(short nIconId, const wxString strText, int nFlags)
} }
TwxOutlookBar::TwxOutlookBar(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size) TwxOutlookBar::TwxOutlookBar(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size)
: wxVListBox(parent, id, pos, size) : wxVListBox(parent, id, pos, size), m_bCaptured(false), m_nHovering(wxNOT_FOUND)
{ {
SetItemCount(0); SetItemCount(0);
} }

View File

@ -216,7 +216,7 @@ public:
#define TIMER_ID 1 #define TIMER_ID 1
const wxString& _GetAppTitle(); const wxString& _GetAppTitle();
wxIcon* _GetIconResource(int rid); const wxIcon* _GetIconResource(int rid);
#define CAST_COLOR(xc, wc) wxColour wc((xc>>16)&0xFF, (xc>>8)&0xFF, xc&0xFF) #define CAST_COLOR(xc, wc) wxColour wc((xc>>16)&0xFF, (xc>>8)&0xFF, xc&0xFF)
#define MAKE_XVT_COLOR(wc) MAKE_COLOR(wc.Red(), wc.Green(), wc.Blue()) #define MAKE_XVT_COLOR(wc) MAKE_COLOR(wc.Red(), wc.Green(), wc.Blue())