Added wxUSE_POCKETPC_UI to distinguish between using

combined toolbar/menubar and using separate ones


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25022 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2003-12-28 01:07:31 +00:00
parent c0f984728e
commit a96b4743ff
10 changed files with 152 additions and 59 deletions

View File

@@ -519,7 +519,7 @@ void wxFrameBase::SetMenuBar(wxMenuBar *menubar)
DetachMenuBar();
AttachMenuBar(menubar);
this->AttachMenuBar(menubar);
}
#endif // wxUSE_MENUS

View File

@@ -320,6 +320,18 @@ void wxFrame::PositionStatusBar()
void wxFrame::AttachMenuBar(wxMenuBar *menubar)
{
#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
if (!GetToolBar())
{
wxToolBar* toolBar = new wxToolBar(this, -1,
wxDefaultPosition, wxDefaultSize,
wxBORDER_NONE | wxTB_HORIZONTAL,
wxToolBarNameStr, GetMenuBar());
SetToolBar(toolBar);
menubar->SetToolBar(toolBar);
}
#endif
wxFrameBase::AttachMenuBar(menubar);
if ( !menubar )
@@ -330,7 +342,7 @@ void wxFrame::AttachMenuBar(wxMenuBar *menubar)
}
else // set new non NULL menu bar
{
#ifndef __WXWINCE__
#if !defined(__WXWINCE__) || (_WIN32_WCE >= 400 && !wxUSE_POCKETPC_UI)
// Can set a menubar several times.
if ( menubar->GetHMenu() )
{
@@ -353,18 +365,8 @@ void wxFrame::AttachMenuBar(wxMenuBar *menubar)
void wxFrame::InternalSetMenuBar()
{
#ifdef __WXMICROWIN__
#if defined(__WXMICROWIN__) || defined(__WXWINCE__)
// Nothing
#elif defined(__WXWINCE__)
if (!GetToolBar())
{
wxToolBar* toolBar = new wxToolBar(this, -1,
wxDefaultPosition, wxDefaultSize,
wxBORDER_NONE | wxTB_HORIZONTAL,
wxToolBarNameStr, GetMenuBar());
SetToolBar(toolBar);
}
#else
if ( !::SetMenu(GetHwnd(), (HMENU)m_hMenu) )
{
@@ -403,7 +405,7 @@ bool wxFrame::ShowFullScreen(bool show, long style)
if (show)
{
#if wxUSE_TOOLBAR
#ifdef __WXWINCE__
#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
// TODO: hide commandbar
#else
wxToolBar *theToolBar = GetToolBar();
@@ -420,8 +422,10 @@ bool wxFrame::ShowFullScreen(bool show, long style)
#endif // __WXWINCE__
#endif // wxUSE_TOOLBAR
#if defined(__WXMICROWIN__)
#elif defined(__WXWINCE__)
// TODO: make it work for WinCE
#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
#else
if (style & wxFULLSCREEN_NOMENUBAR)
SetMenu((HWND)GetHWND(), (HMENU) NULL);
#endif
@@ -446,7 +450,7 @@ bool wxFrame::ShowFullScreen(bool show, long style)
else
{
#if wxUSE_TOOLBAR
#ifdef __WXWINCE__
#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
// TODO: show commandbar
#else
wxToolBar *theToolBar = GetToolBar();
@@ -472,8 +476,10 @@ bool wxFrame::ShowFullScreen(bool show, long style)
}
#endif // wxUSE_STATUSBAR
#if defined(__WXMICROWIN__)
#elif defined(__WXWINCE__)
// TODO: make it work for WinCE
#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
#else
if ((m_fsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0))
SetMenu((HWND)GetHWND(), (HMENU)m_hMenu);
#endif
@@ -490,7 +496,7 @@ bool wxFrame::ShowFullScreen(bool show, long style)
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
#ifdef __WXWINCE__
#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
// We may already have a toolbar from calling SetMenuBar.
if (GetToolBar())
return GetToolBar();
@@ -508,7 +514,7 @@ void wxFrame::PositionToolBar()
wxToolBar *toolbar = GetToolBar();
if ( toolbar && toolbar->IsShown() )
{
#ifdef __WXWINCE__
#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
// We want to do something different in WinCE, because
// the toolbar should be associated with the commandbar,
// and not an independent window.

View File

@@ -673,8 +673,14 @@ void wxMenuBar::Init()
{
m_eventHandler = this;
m_hMenu = 0;
#ifdef __WXWINCE__
#if wxUSE_TOOLBAR && defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
m_toolBar = NULL;
#endif
// Not using a combined wxToolBar/wxMenuBar? then use
// a commandbar in WinCE .NET just to implement the
// menubar.
#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !wxUSE_POCKETPC_UI)
m_commandBar = NULL;
#endif
}
@@ -705,9 +711,9 @@ wxMenuBar::wxMenuBar(int count, wxMenu *menus[], const wxString titles[])
wxMenuBar::~wxMenuBar()
{
// In Windows CE, the menubar is always associated
// In Windows CE (not .NET), the menubar is always associated
// with a toolbar, which destroys the menu implicitly.
#ifdef __WXWINCE__
#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
if (GetToolBar())
GetToolBar()->SetMenuBar(NULL);
#else
@@ -715,7 +721,12 @@ wxMenuBar::~wxMenuBar()
// which happens if we're attached to a frame
if (m_hMenu && !IsAttached())
{
#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !wxUSE_POCKETPC_UI)
::DestroyWindow((HWND) m_commandBar);
m_commandBar = (WXHWND) NULL;
#else
::DestroyMenu((HMENU)m_hMenu);
#endif
m_hMenu = (WXHMENU)NULL;
}
#endif
@@ -729,11 +740,14 @@ void wxMenuBar::Refresh()
{
wxCHECK_RET( IsAttached(), wxT("can't refresh unattached menubar") );
#ifdef __WXWINCE__
#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
if (GetToolBar())
{
CommandBar_DrawMenuBar((HWND) GetToolBar()->GetHWND(), 0);
}
#elif defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !wxUSE_POCKETPC_UI)
if (m_commandBar)
DrawMenuBar((HWND) m_commandBar);
#else
DrawMenuBar(GetHwndOf(GetFrame()));
#endif
@@ -806,17 +820,6 @@ WXHMENU wxMenuBar::Create()
}
}
#if _WIN32_WCE >= 400
if (GetToolBar())
{
HWND hCommandBar = (HWND) GetToolBar()->GetHWND();
if (!CommandBar_InsertMenubarEx(hCommandBar, NULL, (LPTSTR) m_hMenu, 0))
{
wxLogLastError(wxT("CommandBar_InsertMenubarEx"));
}
}
#endif
return m_hMenu;
#endif
}
@@ -953,7 +956,7 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
if ( IsAttached() )
{
#ifdef __WXWINCE__
#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
if (!GetToolBar())
return FALSE;
TBBUTTON tbButton;
@@ -1007,7 +1010,7 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
if ( IsAttached() )
{
#ifdef __WXWINCE__
#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
if (!GetToolBar())
return FALSE;
TBBUTTON tbButton;
@@ -1058,7 +1061,7 @@ wxMenu *wxMenuBar::Remove(size_t pos)
if ( IsAttached() )
{
#ifdef __WXWINCE__
#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
if (GetToolBar())
{
if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_DELETEBUTTON, (UINT) pos, (LPARAM) 0))
@@ -1125,6 +1128,36 @@ void wxMenuBar::Attach(wxFrame *frame)
{
wxMenuBarBase::Attach(frame);
#if defined(__WXWINCE__) && _WIN32_WCE >= 400
if (!m_hMenu)
this->Create();
#if wxUSE_POCKETPC_UI
if (GetToolBar())
{
HWND hCommandBar = (HWND) GetToolBar()->GetHWND();
if (!CommandBar_InsertMenubarEx(hCommandBar, NULL, (LPTSTR) m_hMenu, 0))
{
wxLogLastError(wxT("CommandBar_InsertMenubarEx"));
}
}
#else
if (!m_commandBar)
m_commandBar = (WXHWND) CommandBar_Create(wxGetInstance(), (HWND) frame->GetHWND(), NewControlId());
if (m_commandBar)
{
if (m_hMenu)
{
if (!CommandBar_InsertMenubarEx((HWND) m_commandBar, NULL, (LPTSTR) m_hMenu, 0))
{
wxLogLastError(wxT("CommandBar_InsertMenubarEx"));
}
}
}
#endif
// wxUSE_POCKETPC_UI
#endif
// __WXWINCE__ && _WIN32_WCE >= 400
#if wxUSE_ACCEL
RebuildAccelTable();
#endif // wxUSE_ACCEL

View File

@@ -39,7 +39,7 @@
#include "wx/control.h"
#endif
#if wxUSE_TOOLBAR && defined(__WIN95__) && wxUSE_TOOLBAR_NATIVE
#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !wxUSE_POCKETPC_UI))
#include "wx/toolbar.h"

View File

@@ -39,7 +39,9 @@
#include "wx/control.h"
#endif
#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE
// Use the WinCE-specific toolbar only if we're either compiling
// with a WinCE earlier than 4, or we wish to emulate a PocketPC-style UI
#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
#include "wx/toolbar.h"

View File

@@ -2253,6 +2253,12 @@ SOURCE=..\tabctrl.cpp
SOURCE=..\taskbar.cpp
# End Source File
# Begin Source File
SOURCE=..\tbar95.cpp
# End Source File
# Begin Source File