Patch level : 10.0

Files correlati     : xvaga.dll
Ricompilazione Demo : [ ]
Commento            :
Aggiunto supporto per bottone di chiusura
utile nelle finestre con progress indicator


git-svn-id: svn://10.65.10.50/trunk@17343 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-10-02 15:58:43 +00:00
parent 68569f358f
commit 38d9c163e1
5 changed files with 58 additions and 18 deletions

View File

@ -199,16 +199,31 @@ void* OsWin32_GetPrinterInfo(int& size, const char* printer)
return pdm; return pdm;
} }
void OsWin32_SetCaptionStyle(WXHWND handle, bool set) void OsWin32_SetCaptionStyle(WXHWND handle, long style)
{ {
HWND hwnd = (HWND)handle; HWND hWnd = (HWND)handle;
DWORD s = ::GetWindowLong(hwnd, GWL_STYLE); LONG s = ::GetWindowLong(hWnd, GWL_STYLE);
if (set)
if (style & wxSYSTEM_MENU)
s |= WS_CAPTION; s |= WS_CAPTION;
else else
s &= ~WS_CAPTION; s &= ~WS_CAPTION;
if (style & wxCLOSE_BOX)
s |= WS_SYSMENU;
else
s &= ~WS_SYSMENU;
s |= WS_CLIPSIBLINGS; // Forzatura necessaria da wx261 s |= WS_CLIPSIBLINGS; // Forzatura necessaria da wx261
::SetWindowLong(hwnd, GWL_STYLE, s); ::SetWindowLong(hWnd, GWL_STYLE, s);
if (style & wxCLOSE_BOX)
{
HMENU hMenu = ::GetSystemMenu(hWnd, FALSE);
::EnableMenuItem(hMenu, SC_CLOSE, MF_BYCOMMAND | MF_ENABLED);
HICON hIcon = ::ExtractIcon(NULL, "res/campo.ico", 0);
::SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
}
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////

View File

@ -12,7 +12,7 @@ unsigned int OsWin32_LoadIcon(const char* file);
int OsWin32_EnumerateFamilies(WXHDC hDC, char** families, int max_count); int OsWin32_EnumerateFamilies(WXHDC hDC, char** families, int max_count);
int OsWin32_EnumerateSizes(WXHDC hDC, const char* name, long* sizes, short* scalable, int max_count); int OsWin32_EnumerateSizes(WXHDC hDC, const char* name, long* sizes, short* scalable, int max_count);
void OsWin32_SetCaptionStyle(WXHWND handle, bool set); void OsWin32_SetCaptionStyle(WXHWND handle, long style);
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);

View File

@ -4158,7 +4158,7 @@ RCT* xvt_vobj_get_outer_rect(WINDOW win, RCT *rctp)
return rctp; return rctp;
} }
XVT_PALETTE xvt_vobj_get_palet(WINDOW win) XVT_PALETTE xvt_vobj_get_palet(WINDOW WXUNUSED(win))
{ return NULL; } { return NULL; }
WINDOW xvt_vobj_get_parent(WINDOW win) WINDOW xvt_vobj_get_parent(WINDOW win)
@ -4208,9 +4208,9 @@ BOOLEAN xvt_vobj_is_focusable(WINDOW win)
void xvt_vobj_maximize(WINDOW win) void xvt_vobj_maximize(WINDOW win)
{ {
wxFrame* pMain = wxDynamicCast((wxObject*)win, wxFrame); XVT_ASSERT(win != NULL_WIN && _task_win != NULL);
if (pMain != NULL) if (win == TASK_WIN)
pMain->Maximize(); _task_win->Maximize();
else else
{ {
CAST_WIN(win, w); CAST_WIN(win, w);
@ -4312,7 +4312,7 @@ WINDOW xvt_win_create(WIN_TYPE wtype, const RCT* rct_p, const char* title, int m
const wxRect rct = NormalizeRCT(rct_p); const wxRect rct = NormalizeRCT(rct_p);
const wxString caption = title; const wxString caption = title;
long style = wxCLIP_CHILDREN | wxCLIP_SIBLINGS | wxWANTS_CHARS; long style = wxCLIP_SIBLINGS | wxCLIP_CHILDREN | wxWANTS_CHARS;
if (win_flags & WSF_VSCROLL) if (win_flags & WSF_VSCROLL)
style |= wxVSCROLL; style |= wxVSCROLL;
if (win_flags & WSF_HSCROLL) if (win_flags & WSF_HSCROLL)
@ -4324,6 +4324,8 @@ WINDOW xvt_win_create(WIN_TYPE wtype, const RCT* rct_p, const char* title, int m
case W_DOC: case W_DOC:
if (!caption.IsEmpty()) if (!caption.IsEmpty())
style |= wxSYSTEM_MENU; style |= wxSYSTEM_MENU;
if (win_flags & WSF_CLOSE)
style |= wxSYSTEM_MENU | wxCLOSE_BOX;
break; break;
case W_PLAIN: case W_PLAIN:
// style |= wxBORDER; // Non attivare MAI il bordo! // style |= wxBORDER; // Non attivare MAI il bordo!
@ -4342,9 +4344,9 @@ WINDOW xvt_win_create(WIN_TYPE wtype, const RCT* rct_p, const char* title, int m
w->SetBackgroundStyle(wxBG_STYLE_CUSTOM); // Lo sfondo viene disegnato nella OnPaint w->SetBackgroundStyle(wxBG_STYLE_CUSTOM); // Lo sfondo viene disegnato nella OnPaint
#ifdef WIN32 #ifdef WIN32
OsWin32_SetCaptionStyle(w->GetHWND(), wtype == W_DOC); OsWin32_SetCaptionStyle(w->GetHWND(), style);
#else #else
OsLinux_SetCaptionStyle((wxWindow*)w, style); OsLinux_SetCaptionStyle(w, style);
#endif #endif
if (menu_rid > 0 && menu_rid != 8000) // 8000 = NULL_MENU_RID if (menu_rid > 0 && menu_rid != 8000) // 8000 = NULL_MENU_RID

View File

@ -468,13 +468,33 @@ bool TDCMapper::HasValidDC(WINDOW owner) const
IMPLEMENT_DYNAMIC_CLASS(TwxWindowBase, wxWindow) IMPLEMENT_DYNAMIC_CLASS(TwxWindowBase, wxWindow)
#ifdef WIN32
WXLRESULT TwxWindowBase::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
WXLRESULT rc = 0;
bool processed = false;
switch (nMsg)
{
case WM_CLOSE:
processed = !Close();
break;
default:
break;
}
if ( !processed )
rc = wxWindow::MSWWindowProc(nMsg, wParam, lParam);
return rc;
}
#endif
bool TwxWindowBase::CreateBase(wxWindow *parent, wxWindowID id, const wxString &title, bool TwxWindowBase::CreateBase(wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &pos, const wxSize &size, long style) const wxPoint &pos, const wxSize &size, long style)
{ {
// Evita inutili sfarfallamenti in quanto wxWidgets crea le finestre visibili per default wxWindowBase::Show(false); // Evita inutili sfarfallamenti
wxWindowBase::Show(false); return Create(parent, id, pos, size, style, title);
bool ok = Create(parent, id, pos, size, style, title);
return ok;
} }
TwxWindowBase::TwxWindowBase(wxWindow *parent, wxWindowID id, const wxString &title, TwxWindowBase::TwxWindowBase(wxWindow *parent, wxWindowID id, const wxString &title,

View File

@ -118,6 +118,10 @@ private:
virtual wxString GetTitle() const { return m_strTitle; } virtual wxString GetTitle() const { return m_strTitle; }
#endif #endif
#ifdef WIN32
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
#endif
public: public:
bool CreateBase(wxWindow *parent, wxWindowID id, const wxString &title, bool CreateBase(wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &pos, const wxSize &size, long style); const wxPoint &pos, const wxSize &size, long style);
@ -125,7 +129,6 @@ public:
TwxWindowBase() { } TwxWindowBase() { }
TwxWindowBase(wxWindow *parent, wxWindowID id, const wxString &title, TwxWindowBase(wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint & pos, const wxSize & size, long style); const wxPoint & pos, const wxSize & size, long style);
virtual ~TwxWindowBase() { }
DECLARE_DYNAMIC_CLASS(TwxWindowBase) DECLARE_DYNAMIC_CLASS(TwxWindowBase)
}; };