Patch level : 10.0

Files correlati     : xvaga
Ricompilazione Demo : [ ]
Commento            :
Corretto errore 0000840
Corretta gestione  menu


git-svn-id: svn://10.65.10.50/trunk@16928 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-07-23 15:45:27 +00:00
parent cc2fca8874
commit a10b0a27da
5 changed files with 127 additions and 105 deletions

View File

@ -435,32 +435,26 @@ void xvt_app_create(int argc, char **argv, unsigned long flags,
wxPoint pos = wxDefaultPosition;
wxSize size = wxDefaultSize;
long style = wxDEFAULT_FRAME_STYLE;
bool can_change_firm = true;
wxWindow* pParent = NULL;
bool bHasMenu = true, bCanChangeFirm = true;
#ifdef WIN32
HWND hwndParent = (HWND)OsWin32_FindMenuContainer();
if (hwndParent != NULL)
{
can_change_firm = false;
RECT rct; ::GetWindowRect(hwndParent, &rct);
if (rct.right - rct.left >= 720)
{
style = wxSYSTEM_MENU;
DWORD dwFlags = ::GetWindowLong(hwndParent, GWL_STYLE);
if (dwFlags & WS_CAPTION)
{
xvt_rect_set(&_startup_rect, rct.left, rct.top, rct.right, rct.bottom);
hwndParent = NULL;
}
else
{
xvt_rect_set(&_startup_rect, 0, 0, rct.right-rct.left, rct.bottom-rct.top);
}
}
pParent = new wxWindow;
pParent->AssociateHandle(hwndParent);
const wxSize szWin = pParent->GetSize();
const wxSize szCli = pParent->GetClientSize();
xvt_rect_set(&_startup_rect, 0, 0, szWin.x, szWin.y);
style = wxSYSTEM_MENU; // Lo stile si riduce al minimo: niente cornici
bHasMenu = (szWin.y - szCli.y) < 2;
bCanChangeFirm = false;
}
#endif
if (_startup_rect.right > _startup_rect.left)
{
pos.x = _startup_rect.left;
@ -487,58 +481,55 @@ void xvt_app_create(int argc, char **argv, unsigned long flags,
_task_win->SetBackgroundStyle(wxBG_STYLE_CUSTOM); // Lo sfondo viene disegnato nella OnPaint
_nice_windows.Put((WINDOW)_task_win, _task_win);
#ifdef WIN32
if (hwndParent != NULL)
if (pParent != NULL)
{
// HWND hwndChild = (HWND)_task_win->GetHandle();
// ::SetParent(hwndChild, hwndParent);
wxWindow* padre = new wxWindow;
padre->AssociateHandle(hwndParent);
_task_win->Reparent(padre);
_task_win->Reparent(pParent);
pParent->DissociateHandle();
pParent = NULL;
}
#endif
wxMenu* Menus[3];
wxString Title[3];
Title[0] = "&File";
Menus[0] = new wxMenu;
if (can_change_firm)
if (bHasMenu)
{
Menus[0]->Append(M_FILE_NEW, "Scelta &Ditta...");
wxMenu* Menus[3];
wxString Title[3];
Title[0] = "&File";
Menus[0] = new wxMenu;
if (bCanChangeFirm)
{
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_PRINT, "&Stampa");
Menus[0]->AppendSeparator();
Menus[0]->Append(M_FILE_QUIT, "&Fine");
Title[1] = "&Modifica";
Menus[1] = new wxMenu;
Menus[1]->Append(M_EDIT_CUT, "&Taglia\tCtrl+X");
Menus[1]->Append(M_EDIT_COPY, "&Copia\tCtrl+C");
Menus[1]->Append(M_EDIT_PASTE, "&Incolla\tCtrl+V");
Menus[1]->Append(M_EDIT_CLEAR, "&Elimina\tCanc");
Title[2] = "&Help";
Menus[2] = new wxMenu;
Menus[2]->Append(M_HELP_CONTENTS, "&Sommario");
Menus[2]->Append(M_HELP_SEARCH, "&Cerca argomento");
Menus[2]->Append(M_HELP_HELPONHELP, "&Uso della guida");
Menus[2]->AppendSeparator();
Menus[2]->Append(M_FILE_ABOUT, "&Informazioni");
#ifdef WIN32
wxMenuBar* pMenubar = new wxMenuBar(3, Menus, Title);
#else
wxMenuBar* pMenubar = new wxMenuBar();
for (int i= 0; i < 3; i++)
pMenubar->Append(Menus[i], Title[i]);
#endif
_task_win->SetMenuBar(pMenubar);
}
Menus[0]->Append(M_FILE_PG_SETUP, "&Impostazione Stampante...");
Menus[0]->Append(M_FILE_PRINT, "&Stampa");
Menus[0]->AppendSeparator();
Menus[0]->Append(M_FILE_QUIT, "&Fine");
Title[1] = "&Modifica";
Menus[1] = new wxMenu;
Menus[1]->Append(M_EDIT_CUT, "&Taglia\tCtrl+X");
Menus[1]->Append(M_EDIT_COPY, "&Copia\tCtrl+C");
Menus[1]->Append(M_EDIT_PASTE, "&Incolla\tCtrl+V");
Menus[1]->Append(M_EDIT_CLEAR, "&Elimina\tCanc");
Title[2] = "&Help";
Menus[2] = new wxMenu;
Menus[2]->Append(M_HELP_CONTENTS, "&Sommario");
Menus[2]->Append(M_HELP_SEARCH, "&Cerca argomento");
Menus[2]->Append(M_HELP_HELPONHELP, "&Uso della guida");
Menus[2]->AppendSeparator();
Menus[2]->Append(M_FILE_ABOUT, "&Informazioni");
#ifdef WIN32
wxMenuBar* pMenubar = new wxMenuBar(3, Menus, Title);
#else
wxMenuBar* pMenubar = new wxMenuBar();
for (int i= 0; i < 3; i++)
pMenubar->Append(Menus[i], Title[i]);
#endif
wxFrame* pFrame = wxStaticCast(_task_win, wxFrame);
pFrame->SetMenuBar(pMenubar);
if (style & wxMAXIMIZE)
pFrame->Maximize();
if (style & wxMAXIMIZE)
_task_win->Maximize();
_task_win->Show();
wxApp* a = wxTheApp;
@ -3528,10 +3519,7 @@ wxThread::ExitCode TIconizeTaskThread::Entry()
{
::wxMilliSleep(500);
if (__bChildRunning) // Il programma e' ancora attivo
{
wxFrame* frame = wxStaticCast(_task_win, wxFrame);
frame->Iconize();
}
_task_win->Iconize();
return 0;
}
@ -3554,7 +3542,6 @@ long xvt_sys_execute(const char* cmdline, BOOLEAN sync, BOOLEAN iconizetask)
if (sync)
{
wxFrame* frame = wxStaticCast(_task_win, wxFrame);
if (iconizetask)
{
wxEnableTopLevelWindows(FALSE);
@ -3564,13 +3551,13 @@ long xvt_sys_execute(const char* cmdline, BOOLEAN sync, BOOLEAN iconizetask)
exitcode = wxExecute(cmd, wxEXEC_SYNC);
__bChildRunning = false;
if (frame->IsIconized())
frame->Restore();
if (_task_win->IsIconized())
_task_win->Restore();
wxEnableTopLevelWindows(TRUE);
}
else
exitcode = wxExecute(cmd, wxEXEC_SYNC); // Valutare wxEXEC_NODISABLE
frame->Raise();
_task_win->Raise();
}
else
exitcode = wxExecute(cmd, wxEXEC_ASYNC);
@ -4189,8 +4176,8 @@ void xvt_vobj_maximize(WINDOW win)
void xvt_vobj_minimize(WINDOW win)
{
wxFrame* pMain = wxDynamicCast((wxObject*)win, wxFrame);
if (pMain != NULL)
pMain->Iconize();
if (pMain == _task_win)
_task_win->Iconize();
else
SORRY_BOX();
}
@ -4470,10 +4457,7 @@ static wxStatusBar* WIN2StatBar(WINDOW win)
{
wxStatusBar* pStatusBar = NULL;
if (win == NULL_WIN || win == TASK_WIN)
{
wxFrame* w = wxStaticCast(_task_win, wxFrame);
pStatusBar = w->GetStatusBar();
}
pStatusBar = _task_win->GetStatusBar();
else
pStatusBar = wxDynamicCast((wxObject*)win, wxStatusBar);
return pStatusBar;
@ -4543,9 +4527,8 @@ BOOLEAN statbar_destroy(WINDOW win)
wxStatusBar* pStatusBar = WIN2StatBar(win);
if (pStatusBar != NULL)
{
wxFrame& w = *wxStaticCast(_task_win, wxFrame);
if (w.GetStatusBar() == pStatusBar)
w.SetStatusBar(NULL);
if (_task_win->GetStatusBar() == pStatusBar)
_task_win->SetStatusBar(NULL);
pStatusBar->Destroy();
}
return pStatusBar != NULL;

View File

@ -425,6 +425,7 @@ XVTDLL void xvt_win_trap_pointer(WINDOW win);
XVTDLL BOOLEAN xvt_pane_add(WINDOW parent, WINDOW pane, const char* name, int dock, int flags);
XVTDLL BOOLEAN xvt_pane_change_flags(WINDOW pane, int set, int reset);
XVTDLL BOOLEAN xvt_pane_detach(WINDOW pane);
XVTDLL BOOLEAN xvt_pane_set_size_range(WINDOW pane, int min_size, int max_size);
XVTDLL BOOLEAN xvt_pane_set_title(WINDOW pane, const char* title);
typedef int ODBC_CALLBACK(void*,int,char**, char**);

View File

@ -335,35 +335,43 @@ void xvt_btn_set_images(WINDOW win, XVT_IMAGE up, XVT_IMAGE down)
// Pane interface
///////////////////////////////////////////////////////////
BOOLEAN xvt_pane_add(WINDOW win, WINDOW pane, const char* name, int dock, int flags)
{
BOOLEAN done = FALSE;
if (win != NULL_WIN && pane != NULL_WIN && name && *name)
{
done = ((TwxWindow*)win)->AddPane((wxWindow*)pane, name, dock, flags);
}
return done;
}
static wxAuiPaneInfo* LockPane(WINDOW win)
{
wxWindow* pwin = (wxWindow*)win;
wxAuiManager* pManager = wxAuiManager::GetManager(pwin);
if (pManager != NULL)
if (win != NULL_WIN)
{
wxAuiPaneInfo& pane = pManager->GetPane(pwin);
if (pane.IsOk())
return &pane;
wxWindow* pwin = wxStaticCast((wxObject*)win, wxWindow);
wxAuiManager* pManager = wxAuiManager::GetManager(pwin);
if (pManager != NULL)
{
wxAuiPaneInfo& pane = pManager->GetPane(pwin);
if (pane.IsOk())
return &pane;
}
}
return NULL;
}
static void UnlockPane(WINDOW win)
{
wxWindow* pwin = (wxWindow*)win;
wxAuiManager* pManager = wxAuiManager::GetManager(pwin);
if (pManager != NULL)
pManager->Update();
if (win != NULL_WIN)
{
wxWindow* pwin = wxStaticCast((wxObject*)win, wxWindow);
wxAuiManager* pManager = wxAuiManager::GetManager(pwin);
if (pManager != NULL)
pManager->Update();
}
}
BOOLEAN xvt_pane_add(WINDOW win, WINDOW pane, const char* name, int dock, int flags)
{
BOOLEAN done = FALSE;
if (win != NULL_WIN && pane != NULL_WIN && name && *name)
{
TwxWindow* owner = wxStaticCast((wxObject*)win, TwxWindow);
wxWindow* child = wxStaticCast((wxObject*)pane, wxWindow);
done = owner->AddPane(child, name, dock, flags);
}
return done;
}
BOOLEAN xvt_pane_set_title(WINDOW win, const char* title)
@ -394,7 +402,7 @@ XVTDLL BOOLEAN xvt_pane_detach(WINDOW win)
BOOLEAN ok = FALSE;
if (win != NULL_WIN)
{
wxWindow* pwin = (wxWindow*)win;
wxWindow* pwin = wxStaticCast((wxObject*)win, wxWindow);
wxAuiManager* pManager = wxAuiManager::GetManager(pwin);
if (pManager != NULL)
{
@ -405,6 +413,36 @@ XVTDLL BOOLEAN xvt_pane_detach(WINDOW win)
return ok;
}
XVTDLL BOOLEAN xvt_pane_set_size_range(WINDOW win, int min_size, int max_size)
{
BOOLEAN ok = FALSE;
wxAuiPaneInfo* pane = LockPane(win);
if (pane != NULL)
{
if (min_size > 0 || max_size > 0)
{
wxSize szMin(-1, -1), szMax(-1, -1);
if (pane->IsTopDockable() || pane->IsBottomDockable())
{
szMin.y = min_size;
szMax.y = max_size;
}
else
{
szMin.x = min_size;
szMax.x = max_size;
}
pane->MinSize(szMin);
pane->BestSize(szMin);
pane->MaxSize(szMax);
}
pane->Resizable(min_size != max_size);
pane->DockFixed(min_size == max_size);
UnlockPane(win);
}
return ok;
}
///////////////////////////////////////////////////////////
// Notebook interface
///////////////////////////////////////////////////////////
@ -446,7 +484,7 @@ short TwxNoteBook::AddTab(wxWindow* pPage, const wxString text, XVT_IMAGE xvt_im
if (xvt_img != NULL)
{
wxImage& img = *(wxImage*)xvt_img; // Piccola porcata...
wxImage& img = *wxStaticCast(xvt_img, wxImage);
img.Rescale(BOOK_ICO_SIZE, BOOK_ICO_SIZE, wxIMAGE_QUALITY_HIGH);
bmp = Image2Bitmap(xvt_img, true);
}

View File

@ -16,7 +16,7 @@
///////////////////////////////////////////////////////////
wxHashTable _nice_windows;
wxWindow* _task_win = NULL;
wxFrame* _task_win = NULL;
EVENT_HANDLER _task_win_handler = NULL;
wxRect NormalizeRCT(const RCT* prct)

View File

@ -228,7 +228,7 @@ wxRect NormalizeRCT(const RCT* prct);
#endif
extern wxHashTable _nice_windows;
extern wxWindow* _task_win;
extern wxFrame* _task_win;
extern EVENT_HANDLER _task_win_handler;
#endif