Patch level : 10.0
Files correlati : xvaga.dll Ricompilazione Demo : [ ] Commento : Aggiunto supporto per docking panes ed outlook bars Aggiunto supporto per esecuzione all'interno di una finestra invece che a tutto schermo Migliorata gestione font delle status bar git-svn-id: svn://10.65.10.50/trunk@16065 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
263a3a962c
commit
db6f95f715
@ -501,30 +501,41 @@ struct TFindWindowInfo
|
|||||||
TFindWindowInfo() : _instance(NULL), _hwnd(NULL) { }
|
TFindWindowInfo() : _instance(NULL), _hwnd(NULL) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
|
static BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
|
||||||
{
|
{
|
||||||
TFindWindowInfo* w = (TFindWindowInfo*)lParam;
|
TFindWindowInfo* w = (TFindWindowInfo*)lParam;
|
||||||
|
|
||||||
HINSTANCE inst = (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE);
|
if (w->_instance != NULL)
|
||||||
if (inst == w->_instance)
|
|
||||||
{
|
|
||||||
const LONG style = GetWindowLong(hwnd, GWL_STYLE);
|
|
||||||
if ((style & WS_CAPTION) != 0) // Ha la caption?
|
|
||||||
{
|
|
||||||
w->_hwnd = hwnd;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
char str[256];
|
|
||||||
GetWindowText(hwnd, str, sizeof(str));
|
|
||||||
wxString title = str;
|
|
||||||
title.MakeUpper();
|
|
||||||
if (title.Find(w->_file) >= 0)
|
|
||||||
{
|
{
|
||||||
w->_hwnd = hwnd;
|
// Cerco di capire se e' la finetra principale dal fatto che
|
||||||
return FALSE;
|
// abbia la caption ed i bottoni di chiusura
|
||||||
|
const DWORD dwWanted = WS_CAPTION | WS_SYSMENU;
|
||||||
|
HINSTANCE inst = (HINSTANCE)::GetWindowLong(hwnd, GWL_HINSTANCE);
|
||||||
|
if (inst == w->_instance)
|
||||||
|
{
|
||||||
|
const DWORD style = ::GetWindowLong(hwnd, GWL_STYLE);
|
||||||
|
if ((style & dwWanted) == dwWanted)
|
||||||
|
{
|
||||||
|
w->_hwnd = hwnd;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!w->_file.IsEmpty())
|
||||||
|
{
|
||||||
|
char str[_MAX_PATH];
|
||||||
|
if (::GetWindowText(hwnd, str, sizeof(str)))
|
||||||
|
{
|
||||||
|
wxString title = str;
|
||||||
|
title.MakeUpper();
|
||||||
|
if (title.Find(w->_file) >= 0)
|
||||||
|
{
|
||||||
|
w->_hwnd = hwnd;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -556,6 +567,46 @@ void OsWin32_PlaceProcessInWindow(unsigned int instance, const char* name, unsig
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL CALLBACK EnumCampoChildrenProc(HWND hwnd, LPARAM lParam)
|
||||||
|
{
|
||||||
|
char str[_MAX_PATH];
|
||||||
|
if (::GetWindowText(hwnd, str, sizeof(str)))
|
||||||
|
{
|
||||||
|
TFindWindowInfo* w = (TFindWindowInfo*)lParam;
|
||||||
|
if (w->_file == str)
|
||||||
|
{
|
||||||
|
w->_hwnd = hwnd;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOL CALLBACK EnumCampoWindowsProc(HWND hwnd, LPARAM lParam)
|
||||||
|
{
|
||||||
|
char str[_MAX_PATH];
|
||||||
|
if (::GetWindowText(hwnd, str, sizeof(str)))
|
||||||
|
{
|
||||||
|
const wxString title = str;
|
||||||
|
if (title.StartsWith("Base - "))
|
||||||
|
{
|
||||||
|
::EnumChildWindows(hwnd, EnumCampoChildrenProc, lParam);
|
||||||
|
TFindWindowInfo* w = (TFindWindowInfo*)lParam;
|
||||||
|
if (w->_hwnd != NULL)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int OsWin32_FindMenuContainer()
|
||||||
|
{
|
||||||
|
TFindWindowInfo w;
|
||||||
|
w._file = "__CAMPO_MENU__";
|
||||||
|
::EnumWindows(EnumCampoWindowsProc, LPARAM(&w));
|
||||||
|
return (unsigned int)w._hwnd;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Hardlock Support
|
// Hardlock Support
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -930,3 +981,4 @@ bool OsWin32_IsWindowsServer()
|
|||||||
{
|
{
|
||||||
return ::GetSystemMetrics(SM_REMOTESESSION) != 0;
|
return ::GetSystemMetrics(SM_REMOTESESSION) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ void OsWin32_SetCaptionStyle(WXHWND handle, bool set);
|
|||||||
void* OsWin32_GetPrinterInfo(int& size, const char* printer);
|
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();
|
||||||
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);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* STATBAR.H for dynamic custom control for XVT/Design 2.01
|
/* STATBAR.H for dynamic custom control for XVT/Design 2.01
|
||||||
|
|
||||||
$Revision: 1.2 $ $Author: guy $ $Date: 2003-04-30 15:43:51 $
|
$Revision: 1.3 $ $Author: guy $ $Date: 2008-01-31 14:15:52 $
|
||||||
|
|
||||||
This code was written by Christopher Williamson,
|
This code was written by Christopher Williamson,
|
||||||
May be distributed in object form only when embedded in a
|
May be distributed in object form only when embedded in a
|
||||||
@ -38,6 +38,8 @@ XVTDLL WINDOW statbar_create
|
|||||||
int prop_count, char **prop_list, WINDOW parent_win,
|
int prop_count, char **prop_list, WINDOW parent_win,
|
||||||
int parent_rid, long parent_flags, char *parent_class);
|
int parent_rid, long parent_flags, char *parent_class);
|
||||||
|
|
||||||
|
XVTDLL BOOLEAN statbar_destroy(WINDOW win);
|
||||||
|
|
||||||
#if defined(_cplusplus) || defined(__cplusplus)
|
#if defined(_cplusplus) || defined(__cplusplus)
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
167
xvaga/xvaga.cpp
167
xvaga/xvaga.cpp
@ -11,6 +11,7 @@
|
|||||||
#include "wx/image.h"
|
#include "wx/image.h"
|
||||||
#include "wx/filefn.h"
|
#include "wx/filefn.h"
|
||||||
#include <wx/snglinst.h>
|
#include <wx/snglinst.h>
|
||||||
|
#include <wx/tokenzr.h>
|
||||||
#include <wx/thread.h>
|
#include <wx/thread.h>
|
||||||
|
|
||||||
#include "xvt.h"
|
#include "xvt.h"
|
||||||
@ -300,49 +301,63 @@ void xvt_app_create(int argc, char **argv, unsigned long flags,
|
|||||||
|
|
||||||
const wxString title = config->taskwin_title;
|
const wxString title = config->taskwin_title;
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
wxPoint pos = wxDefaultPosition;
|
wxPoint pos = wxDefaultPosition;
|
||||||
wxSize size = wxDefaultSize;
|
wxSize size = wxDefaultSize;
|
||||||
#else
|
long style = wxDEFAULT_FRAME_STYLE - wxRESIZE_BORDER;
|
||||||
wxRect rect = wxGetClientDisplayRect();
|
|
||||||
wxPoint pos;
|
|
||||||
wxSize size ;
|
|
||||||
|
|
||||||
pos.x = rect.x;
|
|
||||||
pos.y = rect.y;
|
|
||||||
size.x = rect.width;
|
|
||||||
size.y = rect.height;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
long style = wxDEFAULT_FRAME_STYLE;
|
|
||||||
|
|
||||||
if (_startup_rect.right > _startup_rect.left)
|
#ifdef WIN32
|
||||||
{
|
HWND hwndParent = (HWND)OsWin32_FindMenuContainer();
|
||||||
pos.x = _startup_rect.left;
|
if (hwndParent != NULL)
|
||||||
pos.y = _startup_rect.top;
|
{
|
||||||
size.x = _startup_rect.right - _startup_rect.left;
|
RECT rct; ::GetWindowRect(hwndParent, &rct);
|
||||||
size.y = _startup_rect.bottom - _startup_rect.top;
|
if (rct.right - rct.left >= 720)
|
||||||
}
|
xvt_rect_set(&_startup_rect, rct.left, rct.top, rct.right, rct.bottom);
|
||||||
else
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (_startup_rect.right > _startup_rect.left)
|
||||||
|
{
|
||||||
|
pos.x = _startup_rect.left;
|
||||||
|
pos.y = _startup_rect.top;
|
||||||
|
size.x = _startup_rect.right - _startup_rect.left;
|
||||||
|
size.y = _startup_rect.bottom - _startup_rect.top;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
style |= wxMAXIMIZE;
|
style |= wxMAXIMIZE;
|
||||||
|
const wxRect rect = wxGetClientDisplayRect();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
style &= ~wxMAXIMIZE;
|
style &= ~wxMAXIMIZE;
|
||||||
|
const wxRect rect = wxGetClientDisplayRect();
|
||||||
|
pos = rect.GetPosition();
|
||||||
|
size = rect.GetSize();;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
_task_win = new TTaskWin(ICON_RSRC, title, pos, size, style);
|
_task_win = new TTaskWin(ICON_RSRC, title, pos, size, style);
|
||||||
_task_win->SetBackgroundStyle(wxBG_STYLE_CUSTOM); // Lo sfondo viene disegnato nella OnPaint
|
_task_win->SetBackgroundStyle(wxBG_STYLE_CUSTOM); // Lo sfondo viene disegnato nella OnPaint
|
||||||
|
|
||||||
_nice_windows.Put((WINDOW)_task_win, _task_win);
|
_nice_windows.Put((WINDOW)_task_win, _task_win);
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
if (hwndParent != NULL)
|
||||||
|
{
|
||||||
|
HWND hwndChild = (HWND)_task_win->GetHandle();
|
||||||
|
::SetWindowPos(hwndChild, HWND_TOPMOST, pos.x, pos.y, size.x, size.y, SWP_NOMOVE|SWP_NOSIZE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
wxMenu* Menus[3];
|
wxMenu* Menus[3];
|
||||||
wxString Title[3];
|
wxString Title[3];
|
||||||
Title[0] = "&File";
|
Title[0] = "&File";
|
||||||
Menus[0] = new wxMenu;
|
Menus[0] = new wxMenu;
|
||||||
Menus[0]->Append(M_FILE_NEW, "Scelta &Ditta...");
|
|
||||||
Menus[0]->AppendSeparator();
|
if (hwndParent == NULL)
|
||||||
|
{
|
||||||
|
Menus[0]->Append(M_FILE_NEW, "Scelta &Ditta...");
|
||||||
|
Menus[0]->AppendSeparator();
|
||||||
|
}
|
||||||
Menus[0]->Append(M_FILE_PG_SETUP, "&Impostazione Stampante...");
|
Menus[0]->Append(M_FILE_PG_SETUP, "&Impostazione Stampante...");
|
||||||
Menus[0]->Append(M_FILE_PRINT, "&Stampa");
|
Menus[0]->Append(M_FILE_PRINT, "&Stampa");
|
||||||
Menus[0]->AppendSeparator();
|
Menus[0]->AppendSeparator();
|
||||||
@ -414,6 +429,7 @@ void xvt_app_process_pending_events(void)
|
|||||||
{
|
{
|
||||||
while (a->Pending())
|
while (a->Pending())
|
||||||
a->Dispatch();
|
a->Dispatch();
|
||||||
|
a->ProcessIdle(); // Necessario per wxAUI
|
||||||
a->Yield(true);
|
a->Yield(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1150,9 +1166,7 @@ wxFont& TFontId::Font(wxDC* dc, WINDOW win) const
|
|||||||
nSize = (int)(nSize * dPrintScale + 0.5);
|
nSize = (int)(nSize * dPrintScale + 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
// return wxTheFontList->FindOrCreateFont(nSize, Family(), Style(), Weight(), Underline(), FaceName());
|
|
||||||
return XVT_FONT_CACHE.FindOrCreate(nSize, Family(), Style(), Weight(), Underline(), FaceName());
|
return XVT_FONT_CACHE.FindOrCreate(nSize, Family(), Style(), Weight(), Underline(), FaceName());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFontId::Copy(const wxFont& rFont)
|
void TFontId::Copy(const wxFont& rFont)
|
||||||
@ -3380,13 +3394,16 @@ long xvt_sys_execute(const char* cmdline, BOOLEAN sync, BOOLEAN iconizetask)
|
|||||||
|
|
||||||
long xvt_sys_execute_in_window(const char* cmdline, WINDOW win)
|
long xvt_sys_execute_in_window(const char* cmdline, WINDOW win)
|
||||||
{
|
{
|
||||||
long inst = xvt_sys_execute(cmdline, FALSE, FALSE);
|
const long inst = xvt_sys_execute(cmdline, FALSE, FALSE);
|
||||||
if (inst > 0)
|
if (inst > 0 && win != NULL_WIN)
|
||||||
|
{
|
||||||
|
CAST_WIN(win, w);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
OsWin32_PlaceProcessInWindow(inst, "", xvt_vobj_get_attr(ATTR_NATIVE_WINDOW, win));
|
OsWin32_PlaceProcessInWindow(inst, "", (unsigned int)w.GetHandle());
|
||||||
#else
|
#else
|
||||||
OsLinux_PlaceProcessInWindow(inst, "", xvt_vobj_get_attr(ATTR_NATIVE_WINDOW, win));
|
OsLinux_PlaceProcessInWindow(inst, "", w.GetHandle());
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
return inst;
|
return inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3784,7 +3801,7 @@ long xvt_vobj_get_attr(WINDOW win, long data)
|
|||||||
case ATTR_DISPLAY_TYPE:
|
case ATTR_DISPLAY_TYPE:
|
||||||
switch (::wxDisplayDepth()) // Test ormai ridicolo?
|
switch (::wxDisplayDepth()) // Test ormai ridicolo?
|
||||||
{
|
{
|
||||||
case 1: ret = XVT_DISPLAY_MONO; break;
|
case 1: ret = XVT_DISPLAY_MONO; break; // Ridicolissimo :-)
|
||||||
case 4: ret = XVT_DISPLAY_COLOR_16; break;
|
case 4: ret = XVT_DISPLAY_COLOR_16; break;
|
||||||
case 8: ret = XVT_DISPLAY_COLOR_256; break;
|
case 8: ret = XVT_DISPLAY_COLOR_256; break;
|
||||||
default: ret = XVT_DISPLAY_DIRECT_COLOR; break;
|
default: ret = XVT_DISPLAY_DIRECT_COLOR; break;
|
||||||
@ -4192,40 +4209,59 @@ void xvt_win_trap_pointer(WINDOW win)
|
|||||||
// Status bar
|
// Status bar
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static wxStatusBar* WIN2StatBar(WINDOW win)
|
||||||
|
{
|
||||||
|
wxStatusBar* pStatusBar = NULL;
|
||||||
|
if (win == NULL_WIN || win == TASK_WIN)
|
||||||
|
{
|
||||||
|
wxFrame* w = (wxFrame*)_task_win;
|
||||||
|
pStatusBar = w->GetStatusBar();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pStatusBar = (wxStatusBar*)win;
|
||||||
|
return pStatusBar;
|
||||||
|
}
|
||||||
|
|
||||||
const char* statbar_set_title(WINDOW win, const char* text)
|
const char* statbar_set_title(WINDOW win, const char* text)
|
||||||
{
|
{
|
||||||
XVT_ASSERT(win == TASK_WIN);
|
wxStatusBar* pStatusBar = WIN2StatBar(win);
|
||||||
wxFrame& w = *(wxFrame*)win;
|
if (pStatusBar != NULL)
|
||||||
|
{
|
||||||
if (text == NULL)
|
if (text == NULL)
|
||||||
text = _strDefaultStatbarText;
|
text = _strDefaultStatbarText;
|
||||||
char* tab = (char*)strchr(text, '\t');
|
wxStringTokenizer tok(text, "\t", wxTOKEN_RET_EMPTY);
|
||||||
if (tab)
|
for (int t = 0; tok.HasMoreTokens(); t++)
|
||||||
{
|
pStatusBar->SetStatusText(tok.GetNextToken(), t);
|
||||||
w.SetStatusText(tab+1, 1);
|
}
|
||||||
*tab = '\0';
|
|
||||||
w.SetStatusText(text);
|
|
||||||
*tab = '\t';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
w.SetStatusText(text);
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* statbar_set_default_title(WINDOW win, const char *text)
|
const char* statbar_set_default_title(WINDOW win, const char *text)
|
||||||
{
|
{
|
||||||
_strDefaultStatbarText = text;
|
_strDefaultStatbarText = text;
|
||||||
return statbar_set_title(win, _strDefaultStatbarText);
|
return statbar_set_title(win, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
XVT_FNTID statbar_set_fontid(WINDOW win, XVT_FNTID fontid)
|
XVT_FNTID statbar_set_fontid(WINDOW win, XVT_FNTID fontid)
|
||||||
{
|
{
|
||||||
return fontid; // TBI???
|
wxStatusBar* pStatBar = WIN2StatBar(win);
|
||||||
|
if (pStatBar != NULL && fontid != NULL)
|
||||||
|
{
|
||||||
|
const TFontId& font = *(const TFontId*)fontid;
|
||||||
|
pStatBar->SetFont(font.Font(NULL, win));
|
||||||
|
}
|
||||||
|
return fontid;
|
||||||
}
|
}
|
||||||
|
|
||||||
XVT_FNTID statbar_get_fontid(WINDOW win, XVT_FNTID fontid)
|
XVT_FNTID statbar_get_fontid(WINDOW win, XVT_FNTID fontid)
|
||||||
{
|
{
|
||||||
return fontid; // VERIFICARE
|
wxStatusBar* pStatBar = WIN2StatBar(win);
|
||||||
|
if (pStatBar != NULL && fontid != NULL)
|
||||||
|
{
|
||||||
|
TFontId& font = *(TFontId*)fontid;
|
||||||
|
font.Copy(pStatBar->GetFont());
|
||||||
|
}
|
||||||
|
return fontid;
|
||||||
}
|
}
|
||||||
|
|
||||||
WINDOW statbar_create(int cid, int left, int top, int right, int bottom,
|
WINDOW statbar_create(int cid, int left, int top, int right, int bottom,
|
||||||
@ -4233,17 +4269,28 @@ WINDOW statbar_create(int cid, int left, int top, int right, int bottom,
|
|||||||
int parent_rid, long parent_flags, char *parent_class)
|
int parent_rid, long parent_flags, char *parent_class)
|
||||||
{
|
{
|
||||||
XVT_ASSERT(parent_win == TASK_WIN);
|
XVT_ASSERT(parent_win == TASK_WIN);
|
||||||
TTaskWin& w = *(TTaskWin*)_task_win;
|
wxFrame& w = *(wxFrame*)_task_win;
|
||||||
w.CreateStatusBar(2);
|
wxStatusBar* pStatusBar = w.CreateStatusBar(2, 0); // NOT w.CreateStatusBar(2, wxST_SIZEGRIP)
|
||||||
w.GetStatusBar()->Show();
|
if (pStatusBar != NULL)
|
||||||
wxSize sz = w.GetClientSize();
|
{
|
||||||
|
const wxSize sz = pStatusBar->GetSize();
|
||||||
int widths[2];
|
const int widths[2] = { -1, 256 };
|
||||||
widths[0] = -1;
|
pStatusBar->SetStatusWidths(2, widths);
|
||||||
widths[1] = sz.x / 4;
|
}
|
||||||
w.SetStatusWidths(2, widths);
|
return (WINDOW)pStatusBar;
|
||||||
|
}
|
||||||
|
|
||||||
return (WINDOW)&w;
|
BOOLEAN statbar_destroy(WINDOW win)
|
||||||
|
{
|
||||||
|
wxStatusBar* pStatusBar = WIN2StatBar(win);
|
||||||
|
if (pStatusBar != NULL)
|
||||||
|
{
|
||||||
|
wxFrame& w = *(wxFrame*)_task_win;
|
||||||
|
if (w.GetStatusBar() == pStatusBar)
|
||||||
|
w.SetStatusBar(NULL);
|
||||||
|
pStatusBar->Destroy();
|
||||||
|
}
|
||||||
|
return pStatusBar != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void xvt_btn_set_images(WINDOW win, XVT_IMAGE up, XVT_IMAGE down)
|
void xvt_btn_set_images(WINDOW win, XVT_IMAGE up, XVT_IMAGE down)
|
||||||
|
@ -28,7 +28,6 @@ IMPLEMENT_DYNAMIC_CLASS(TMainApp, wxApp)
|
|||||||
DECLARE_APP(TMainApp)
|
DECLARE_APP(TMainApp)
|
||||||
IMPLEMENT_APP(TMainApp)
|
IMPLEMENT_APP(TMainApp)
|
||||||
|
|
||||||
|
|
||||||
#define TIMER_ID 883
|
#define TIMER_ID 883
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(TMainApp, wxApp)
|
BEGIN_EVENT_TABLE(TMainApp, wxApp)
|
||||||
|
@ -207,6 +207,11 @@ XVTDLL void xvt_image_set_ncolors(XVT_IMAGE image, short ncolors);
|
|||||||
XVTDLL void xvt_image_set_pixel(XVT_IMAGE image, short x, short y, COLOR color);
|
XVTDLL void xvt_image_set_pixel(XVT_IMAGE image, short x, short y, COLOR color);
|
||||||
XVTDLL void xvt_image_transfer(XVT_IMAGE dstimage, XVT_IMAGE srcimage, RCT *dstrctp, RCT *srcrctp);
|
XVTDLL void xvt_image_transfer(XVT_IMAGE dstimage, XVT_IMAGE srcimage, RCT *dstrctp, RCT *srcrctp);
|
||||||
|
|
||||||
|
XVTDLL int xvt_list_add_item(WINDOW win, short icon, const char* text, int flags);
|
||||||
|
XVTDLL BOOLEAN xvt_list_clear(WINDOW win);
|
||||||
|
XVTDLL BOOLEAN xvt_list_get_sel_index(WINDOW win);
|
||||||
|
XVTDLL BOOLEAN xvt_list_set_sel(WINDOW win, int index, BOOLEAN select);
|
||||||
|
|
||||||
XVTDLL DATA_PTR xvt_mem_alloc(size_t size);
|
XVTDLL DATA_PTR xvt_mem_alloc(size_t size);
|
||||||
XVTDLL void xvt_mem_free(DATA_PTR p);
|
XVTDLL void xvt_mem_free(DATA_PTR p);
|
||||||
XVTDLL DATA_PTR xvt_mem_realloc(DATA_PTR p, size_t size);
|
XVTDLL DATA_PTR xvt_mem_realloc(DATA_PTR p, size_t size);
|
||||||
|
@ -230,7 +230,8 @@ WC_HGAUGE, /* horizontal progress bar */
|
|||||||
WC_VGAUGE, /* vertical progress bar */
|
WC_VGAUGE, /* vertical progress bar */
|
||||||
WC_NOTEBK, /* notebook control */
|
WC_NOTEBK, /* notebook control */
|
||||||
WC_HTML, /* HTML control */
|
WC_HTML, /* HTML control */
|
||||||
WC_TREE, /* tree view */
|
WC_TREE, /* tree view */
|
||||||
|
WC_OUTLOOKBAR, /* Barra di outlook */
|
||||||
} WIN_TYPE;
|
} WIN_TYPE;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
262
xvaga/xvtwin.cpp
262
xvaga/xvtwin.cpp
@ -4,12 +4,14 @@
|
|||||||
#include "xvt.h"
|
#include "xvt.h"
|
||||||
#include "xvtwin.h"
|
#include "xvtwin.h"
|
||||||
|
|
||||||
#include "wx/image.h"
|
|
||||||
#include "wx/notebook.h"
|
|
||||||
#include "wx/treectrl.h"
|
|
||||||
#if wxCHECK_VERSION(2,8,7)
|
#if wxCHECK_VERSION(2,8,7)
|
||||||
#include "wx/aui/aui.h"
|
#include "wx/aui/aui.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "wx/notebook.h"
|
||||||
|
#include "wx/treectrl.h"
|
||||||
|
#include "wx/vlbox.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Utilities
|
// Utilities
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -514,9 +516,9 @@ BEGIN_EVENT_TABLE(TwxWindow, TwxWindowBase)
|
|||||||
EVT_SET_FOCUS(TwxWindow::OnSetFocus)
|
EVT_SET_FOCUS(TwxWindow::OnSetFocus)
|
||||||
EVT_SIZE(TwxWindow::OnSize)
|
EVT_SIZE(TwxWindow::OnSize)
|
||||||
EVT_TIMER(TIMER_ID, TwxWindow::OnTimer)
|
EVT_TIMER(TIMER_ID, TwxWindow::OnTimer)
|
||||||
EVT_COMMAND_RANGE(1, 9999, wxEVT_COMMAND_BUTTON_CLICKED, TwxWindow::OnButton)
|
EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, TwxWindow::OnButton)
|
||||||
EVT_COMMAND_RANGE(1, 9999, wxEVT_COMMAND_CHECKBOX_CLICKED, TwxWindow::OnCheckBox)
|
EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, TwxWindow::OnCheckBox)
|
||||||
EVT_COMMAND_RANGE(1, 9999, wxEVT_COMMAND_RADIOBUTTON_SELECTED, TwxWindow::OnRadioButton)
|
EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_RADIOBUTTON_SELECTED, TwxWindow::OnRadioButton)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
void TwxWindow::DoXvtEvent(EVENT& e)
|
void TwxWindow::DoXvtEvent(EVENT& e)
|
||||||
@ -889,16 +891,16 @@ BOOLEAN TwxWindow::AddPane(wxWindow* wnd, const char* caption, int nDock, int nF
|
|||||||
switch (nDock)
|
switch (nDock)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
pane.Left().LeftDockable().RightDockable().MinSize(sz.x/2, -1);
|
pane.Left().Floatable(true).LeftDockable().RightDockable().MinSize(sz.x/2, -1);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
pane.Top().TopDockable().BottomDockable().MinSize(-1, sz.y/2);
|
pane.Top().Floatable(true).TopDockable().BottomDockable().MinSize(-1, sz.y/2);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
pane.Right().LeftDockable().RightDockable().MinSize(sz.x/2, -1);
|
pane.Right().Floatable(true).LeftDockable().RightDockable().MinSize(sz.x/2, -1);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
pane.Bottom().TopDockable().BottomDockable().MinSize(-1, sz.y/2);
|
pane.Bottom().Floatable(true).TopDockable().BottomDockable().MinSize(-1, sz.y/2);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pane.CentrePane().Floatable(false);
|
pane.CentrePane().Floatable(false);
|
||||||
@ -941,11 +943,9 @@ TwxWindow::~TwxWindow()
|
|||||||
xvt_res_free_menu_tree(m_menu);
|
xvt_res_free_menu_tree(m_menu);
|
||||||
((TTaskWin*)_task_win)->PopMenuTree();
|
((TTaskWin*)_task_win)->PopMenuTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
_nice_windows.Delete((WINDOW)this);
|
_nice_windows.Delete((WINDOW)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Main application = TASK_WIN functions
|
// Main application = TASK_WIN functions
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -987,20 +987,27 @@ void TTaskWin::OnMenu(wxCommandEvent& evt)
|
|||||||
|
|
||||||
void TTaskWin::OnPaint(wxPaintEvent& WXUNUSED(evt))
|
void TTaskWin::OnPaint(wxPaintEvent& WXUNUSED(evt))
|
||||||
{
|
{
|
||||||
EVENT e; memset(&e, 0, sizeof(EVENT));
|
const wxRect rctDamaged = GetUpdateRegion().GetBox();
|
||||||
e.type = E_UPDATE;
|
if (!rctDamaged.IsEmpty())
|
||||||
RCT& rct = e.v.update.rct;
|
{
|
||||||
|
EVENT e; memset(&e, 0, sizeof(EVENT));
|
||||||
|
e.type = E_UPDATE;
|
||||||
|
RCT& rct = e.v.update.rct;
|
||||||
|
rct.left = rctDamaged.x;
|
||||||
|
rct.top = rctDamaged.y;
|
||||||
|
rct.right = rctDamaged.GetRight()+1;
|
||||||
|
rct.bottom = rctDamaged.GetBottom()+1;
|
||||||
|
|
||||||
wxRect rctDamaged = GetUpdateRegion().GetBox();
|
TDC& dc = GetTDCMapper().GetTDC((WINDOW)this);
|
||||||
rct.left = rctDamaged.x;
|
dc.GetDC(true); // Forza la creazione di un wxPaintDC
|
||||||
rct.top = rctDamaged.y;
|
_task_win_handler((WINDOW)this, &e);
|
||||||
rct.right = rctDamaged.GetRight()+1;
|
dc.KillDC();
|
||||||
rct.bottom = rctDamaged.GetBottom()+1;
|
}
|
||||||
|
else
|
||||||
TDC& dc = GetTDCMapper().GetTDC((WINDOW)this);
|
{
|
||||||
dc.GetDC(true); // Forza la creazione di un wxPaintDC
|
// Tempo risparmiato
|
||||||
_task_win_handler((WINDOW)this, &e);
|
int keku = 1;
|
||||||
dc.KillDC();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTaskWin::OnSize(wxSizeEvent& evt)
|
void TTaskWin::OnSize(wxSizeEvent& evt)
|
||||||
@ -1082,9 +1089,8 @@ void TTaskWin::PopMenuTree()
|
|||||||
m_MenuOwner = NULL; // = this;
|
m_MenuOwner = NULL; // = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
TTaskWin::TTaskWin(wxWindowID id,
|
TTaskWin::TTaskWin(wxWindowID id, const wxString& title,
|
||||||
const wxString& title, const wxPoint& pos,
|
const wxPoint& pos, const wxSize& size, long style)
|
||||||
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);
|
wxIcon* ico = _GetIconResource(ICON_RSRC);
|
||||||
@ -1162,6 +1168,31 @@ public:
|
|||||||
TwxTreeCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size);
|
TwxTreeCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct TwxOutlookItem
|
||||||
|
{
|
||||||
|
wxString m_strText;
|
||||||
|
short m_nIconId;
|
||||||
|
int m_nFlags;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TwxOutlookBar : public wxVListBox
|
||||||
|
{
|
||||||
|
enum { MAX_ITEMS = 32 };
|
||||||
|
TwxOutlookItem m_item[MAX_ITEMS];
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
||||||
|
protected:
|
||||||
|
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 wxCoord OnMeasureItem(size_t n) const;
|
||||||
|
|
||||||
|
virtual void OnSelected(wxCommandEvent& e);
|
||||||
|
|
||||||
|
public:
|
||||||
|
int Add(short nIconId, const wxString strText, int nFlags);
|
||||||
|
TwxOutlookBar(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size);
|
||||||
|
};
|
||||||
|
|
||||||
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);
|
wxASSERT(win_def_p != NULL);
|
||||||
@ -1240,6 +1271,12 @@ WINDOW xvt_ctl_create_def(WIN_DEF *win_def_p, WINDOW parent_win, long app_data)
|
|||||||
tv->SetFont(font);
|
tv->SetFont(font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case WC_OUTLOOKBAR:
|
||||||
|
{
|
||||||
|
TwxOutlookBar* tob = new TwxOutlookBar(pParent, id, rct.GetPosition(), rct.GetSize());
|
||||||
|
win = (WINDOW)tob;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
SORRY_BOX(); break;
|
SORRY_BOX(); break;
|
||||||
@ -1765,3 +1802,172 @@ void xvt_treeview_suspend(WINDOW win)
|
|||||||
CAST_TREEVIEW(win, tv);
|
CAST_TREEVIEW(win, tv);
|
||||||
tv.Suspend();
|
tv.Suspend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// TwxOutlookBar
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(TwxOutlookBar, wxVListBox)
|
||||||
|
EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LISTBOX_SELECTED, TwxOutlookBar::OnSelected)
|
||||||
|
EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, TwxOutlookBar::OnSelected)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
static wxAuiDockArt* GetArtist(const wxWindow* pWindow)
|
||||||
|
{
|
||||||
|
wxAuiDockArt* pArtist = NULL;
|
||||||
|
const wxAuiManager* pManager = wxAuiManager::GetManager(pWindow->GetParent());
|
||||||
|
if (pManager != NULL)
|
||||||
|
pArtist = pManager->GetArtProvider();
|
||||||
|
return pArtist;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int GrayLevel(const wxColour& col)
|
||||||
|
{
|
||||||
|
const unsigned char r = col.Red();
|
||||||
|
const unsigned char g = col.Green();
|
||||||
|
const unsigned char b = col.Blue();
|
||||||
|
int k = (int)(0.299 * r + 0.587 * g + 0.114 * b);
|
||||||
|
return k;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwxOutlookBar::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const
|
||||||
|
{
|
||||||
|
wxAuiDockArt* pArtist = GetArtist(this);
|
||||||
|
|
||||||
|
wxColour color1, color2;
|
||||||
|
if (n == GetSelection())
|
||||||
|
{
|
||||||
|
color1 = wxColour(251,230,148); // Colori predefiniti di Outlook
|
||||||
|
color2 = wxColour(238,149, 21);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
color1 = pArtist->GetColour(wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR);
|
||||||
|
color2 = pArtist->GetColour(wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR);
|
||||||
|
}
|
||||||
|
dc.GradientFillLinear(rect, color1, color2, wxDOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwxOutlookBar::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const
|
||||||
|
{
|
||||||
|
const int nSide = rect.height;
|
||||||
|
const TwxOutlookItem& oi = m_item[n];
|
||||||
|
int nTextOffset = 4;
|
||||||
|
if (oi.m_nIconId > 0)
|
||||||
|
{
|
||||||
|
wxIcon* pIcon = _GetIconResource(oi.m_nIconId);
|
||||||
|
if (pIcon != NULL)
|
||||||
|
{
|
||||||
|
const wxSize szIco(pIcon->GetWidth(), pIcon->GetHeight());
|
||||||
|
dc.DrawIcon(*pIcon, rect.x+nTextOffset, rect.y+(nSide-szIco.y)/2);
|
||||||
|
nTextOffset += nTextOffset+szIco.x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wxAuiDockArt* pArtist = GetArtist(this);
|
||||||
|
wxFont font = pArtist->GetFont(wxAUI_DOCKART_CAPTION_FONT);
|
||||||
|
font.SetWeight(wxFONTWEIGHT_BOLD);
|
||||||
|
dc.SetFont(font);
|
||||||
|
|
||||||
|
wxColour color;
|
||||||
|
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);
|
||||||
|
|
||||||
|
const wxSize szText = dc.GetTextExtent(oi.m_strText);
|
||||||
|
dc.DrawText(oi.m_strText, rect.x+nTextOffset, rect.y+(nSide-szText.y)/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxCoord TwxOutlookBar::OnMeasureItem(size_t n) const
|
||||||
|
{
|
||||||
|
const int nItems = GetItemCount();
|
||||||
|
wxCoord nHeight = 36;
|
||||||
|
if (nItems > 1)
|
||||||
|
{
|
||||||
|
const wxSize sz = GetSize();
|
||||||
|
nHeight = max(sz.y / nItems, nHeight);
|
||||||
|
}
|
||||||
|
return nHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwxOutlookBar::OnSelected(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_OUTLOOKBAR;
|
||||||
|
e.v.ctl.ci.win = WINDOW(this);
|
||||||
|
e.v.ctl.ci.v.lbox.dbl_click = evt.GetEventType() == wxEVT_COMMAND_LISTBOX_DOUBLECLICKED;
|
||||||
|
TwxWindow* win = (TwxWindow*)GetParent();
|
||||||
|
win->DoXvtEvent(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
int TwxOutlookBar::Add(short nIconId, const wxString strText, int nFlags)
|
||||||
|
{
|
||||||
|
int i = GetItemCount();
|
||||||
|
const bool ok = i < MAX_ITEMS-1;
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
m_item[i].m_nIconId = nIconId;
|
||||||
|
m_item[i].m_strText = strText;
|
||||||
|
m_item[i].m_nFlags = nFlags;
|
||||||
|
SetItemCount(i+1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
i = -1;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
TwxOutlookBar::TwxOutlookBar(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size)
|
||||||
|
: wxVListBox(parent, id, pos, size)
|
||||||
|
{
|
||||||
|
SetItemCount(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int xvt_list_add_item(WINDOW win, short icon, const char* text, int flags)
|
||||||
|
{
|
||||||
|
int n = -1;
|
||||||
|
if (win != NULL_WIN)
|
||||||
|
{
|
||||||
|
TwxOutlookBar* olb = (TwxOutlookBar*)win;
|
||||||
|
n = olb->Add(icon, text, flags);
|
||||||
|
}
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN xvt_list_clear(WINDOW win)
|
||||||
|
{
|
||||||
|
BOOLEAN ok = win != NULL_WIN;
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
TwxOutlookBar* olb = (TwxOutlookBar*)win;
|
||||||
|
olb->Clear();
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN xvt_list_get_sel_index(WINDOW win)
|
||||||
|
{
|
||||||
|
int sel = -1;
|
||||||
|
BOOLEAN ok = win != NULL_WIN;
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
TwxOutlookBar* olb = (TwxOutlookBar*)win;
|
||||||
|
sel = olb->GetSelection();
|
||||||
|
}
|
||||||
|
return sel;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN xvt_list_set_sel(WINDOW win, int index, BOOLEAN select)
|
||||||
|
{
|
||||||
|
BOOLEAN ok = win != NULL_WIN;
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
TwxOutlookBar* olb = (TwxOutlookBar*)win;
|
||||||
|
if (select)
|
||||||
|
olb->SetSelection(index);
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user