Added wxDialog::GetToolBar for PocketPC

Added note about creating installers for PPC


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32908 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2005-03-19 12:06:56 +00:00
parent 83c84d5908
commit ec5f0c2412
8 changed files with 100 additions and 43 deletions

View File

@@ -61,6 +61,8 @@ wxWinCE:
- Sends wxEVT_HIBERNATE event. - Sends wxEVT_HIBERNATE event.
- Now fakes wxEVT_ACTIVATE_APP to be symmetrical with wxEVT_HIBERNATE. - Now fakes wxEVT_ACTIVATE_APP to be symmetrical with wxEVT_HIBERNATE.
- Added wxTE_CAPITALIZE for CAPEDIT controls. - Added wxTE_CAPITALIZE for CAPEDIT controls.
- wxDialog::GetToolBar can be used if you need to add buttons
to the dialog's toolbar.
2.5.4 2.5.4
----- -----

View File

@@ -242,6 +242,16 @@ a code to the application.
Returns the title of the dialog box. Returns the title of the dialog box.
\membersection{wxDialog::GetToolBar}\label{wxdialoggettoolbar}
\constfunc{wxToolBar*}{GetToolBar}{\void}
On PocketPC, a dialog is automatically provided with an empty toolbar. GetToolBar
allows you to access the toolbar and add tools to it. Removing tools and adding
arbitrary controls are not currently supported.
This function is not available on any other platform.
\membersection{wxDialog::Iconize}\label{wxdialogiconized} \membersection{wxDialog::Iconize}\label{wxdialogiconized}
\func{void}{Iconize}{\param{const bool}{ iconize}} \func{void}{Iconize}{\param{const bool}{ iconize}}

View File

@@ -176,7 +176,7 @@ intended to co-exist with the main application frame.
\wxheading{Menubars and toolbars in PocketPC} \wxheading{Menubars and toolbars in PocketPC}
On PocketPC, a frame must always have a menubar, even if it's empty. On PocketPC, a frame must always have a menubar, even if it's empty.
An empty menubar is automatically provided for dialogs, to hide An empty menubar/toolbar is automatically provided for dialogs, to hide
any existing menubar for the duration of the dialog. any existing menubar for the duration of the dialog.
Menubars and toolbars are implemented using a combined control, Menubars and toolbars are implemented using a combined control,
@@ -193,8 +193,16 @@ formatting toolbar above the menubar as Pocket Word does. But don't assign
a wxToolBar to a frame using SetToolBar - you should always use CreateToolBar a wxToolBar to a frame using SetToolBar - you should always use CreateToolBar
for the main frame toolbar. for the main frame toolbar.
\item Deleting and adding tools to wxToolMenuBar is not supported. \item Deleting and adding tools to wxToolMenuBar is not supported.
\item For speed, colours are not remapped to the system colours as they are
in wxMSW. Provide the tool bitmaps either with the correct system button background,
or with transparency (for example, using XPMs).
\end{itemize} \end{itemize}
Unlike in all other ports, a wxDialog has a wxToolBar, automatically created
for you. You may either leave it blank, or access it with wxDialog::GetToolBar
and add buttons, then calling wxToolBar::Realize. You cannot set or recreate
the toolbar.
\wxheading{Menubars and toolbars in Smartphone} \wxheading{Menubars and toolbars in Smartphone}
On Smartphone, there are only two menu buttons, so a menubar is simulated On Smartphone, there are only two menu buttons, so a menubar is simulated
@@ -227,6 +235,32 @@ This section is currently incomplete.
You can use the help controller wxWinceHelpController which controls You can use the help controller wxWinceHelpController which controls
simple {\tt .htm} files, usually installed in the Windows directory. simple {\tt .htm} files, usually installed in the Windows directory.
See the Windows CE reference for how to format the HTML files.
\subsubsection{Installing your PocketPC and Smartphone applications}
To install your application, you need to build a CAB file using
the parameters defined in a special .inf file. The CabWiz program
in your SDK will compile the CAB file from the .inf file and
files that it specifies.
For delivery, you can simply ask the user to copy the CAB file to the
device and execute the CAB file using File Explorer. Or, you can
write a program for the desktop PC that will find the ActiveSync
Application Manager and install the CAB file on the device,
which is obviously much easier for the user.
Here are some links that may help.
\itemsep=0pt
\begin{itemize}
\item A setup builder that takes CABs and builds a setup program is at \urlref{http://www.eskimo.com/~scottlu/win/index.html}{http://www.eskimo.com/~scottlu/win/index.html}.
\item Sample installation files can be found in {\tt Windows CE Tools/wce420/POCKET PC 2003/Samples/Win32/AppInst}.
\item An installer generator using wxPython can be found at \urlref{http://ppcquicksoft.iespana.es/ppcquicksoft/myinstall.html}{http://ppcquicksoft.iespana.es/ppcquicksoft/myinstall.html}.
\item Miscellaneous Windows CE resources can be found at \urlref{http://www.orbworks.com/pcce/resources.html}{http://www.orbworks.com/pcce/resources.html}.
\item Installer creation instructions with a setup.exe for installing to PPC can be found at \urlref{http://www.pocketpcdn.com/articles/creatingsetup.html}{http://www.pocketpcdn.com/articles/creatingsetup.html}.
\item Microsoft instructions are at \urlref{http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnce30/html/appinstall30.asp?frame=true&hidetoc=true}{http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnce30/html/appinstall30.asp?frame=true&hidetoc=true}.
\end{itemize}
\subsubsection{Remaining issues} \subsubsection{Remaining issues}
@@ -245,7 +279,7 @@ icons, should be implemented. This will be quite straightforward.
and the remaining area, by calling SHSipInfo. We also may need to be able to show and hide and the remaining area, by calling SHSipInfo. We also may need to be able to show and hide
the SIP programmatically, with SHSipPreference. See also the {\it Input Dialogs} topic in the SIP programmatically, with SHSipPreference. See also the {\it Input Dialogs} topic in
the {\it Programming Windows CE} guide for more on this, and how to have dialogs the {\it Programming Windows CE} guide for more on this, and how to have dialogs
show the SIP automatically using the WC_SIPREF control. show the SIP automatically using the WC\_SIPREF control.
\item {\bf Drawing.} The "Life!" demo shows some droppings being left on the window, \item {\bf Drawing.} The "Life!" demo shows some droppings being left on the window,
indicating that drawing works a bit differently between desktop and mobile versions of indicating that drawing works a bit differently between desktop and mobile versions of
Win32. Win32.

View File

@@ -22,6 +22,10 @@ extern WXDLLEXPORT_DATA(const wxChar*) wxDialogNameStr;
class WXDLLEXPORT wxDialogModalData; class WXDLLEXPORT wxDialogModalData;
#if wxUSE_TOOLBAR && (defined(__SMARTPHONE__) || defined(__POCKETPC__))
class WXDLLEXPORT wxToolBar;
#endif
// Dialog boxes // Dialog boxes
class WXDLLEXPORT wxDialog : public wxDialogBase class WXDLLEXPORT wxDialog : public wxDialogBase
{ {
@@ -59,6 +63,20 @@ public:
// may be called to terminate the dialog with the given return code // may be called to terminate the dialog with the given return code
virtual void EndModal(int retCode); virtual void EndModal(int retCode);
#if wxUSE_TOOLBAR && defined(__POCKETPC__)
// create main toolbar by calling OnCreateToolBar()
virtual wxToolBar* CreateToolBar(long style = -1,
wxWindowID winid = wxID_ANY,
const wxString& name = wxToolBarNameStr);
// return a new toolbar
virtual wxToolBar *OnCreateToolBar(long style,
wxWindowID winid,
const wxString& name );
// get the main toolbar
wxToolBar *GetToolBar() const { return m_dialogToolBar; }
#endif
// implementation only from now on // implementation only from now on
// ------------------------------- // -------------------------------
@@ -123,10 +141,13 @@ private:
wxWindow* m_oldFocus; wxWindow* m_oldFocus;
bool m_endModalCalled; // allow for closing within InitDialog bool m_endModalCalled; // allow for closing within InitDialog
#if wxUSE_TOOLBAR && defined(__POCKETPC__)
wxToolBar* m_dialogToolBar;
#endif
// this pointer is non-NULL only while the modal event loop is running // this pointer is non-NULL only while the modal event loop is running
wxDialogModalData *m_modalData; wxDialogModalData *m_modalData;
DECLARE_DYNAMIC_CLASS(wxDialog) DECLARE_DYNAMIC_CLASS(wxDialog)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
DECLARE_NO_COPY_CLASS(wxDialog) DECLARE_NO_COPY_CLASS(wxDialog)

View File

@@ -165,11 +165,6 @@ protected:
void ReloadAllButtons(); void ReloadAllButtons();
#endif // __SMARTPHONE__ && __WXWINCE__ #endif // __SMARTPHONE__ && __WXWINCE__
// Empty menubar for dialogs
#ifdef __POCKETPC__
WXHWND m_menuBarHWND;
#endif
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
DECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW) DECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW)
}; };

View File

@@ -51,6 +51,10 @@
#include "wx/msw/wince/resources.h" #include "wx/msw/wince/resources.h"
#endif // __SMARTPHONE__ && __WXWINCE__ #endif // __SMARTPHONE__ && __WXWINCE__
#if wxUSE_TOOLBAR && defined(__POCKETPC__)
#include "wx/toolbar.h"
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxWin macros // wxWin macros
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -160,6 +164,9 @@ void wxDialog::Init()
m_isShown = false; m_isShown = false;
m_modalData = NULL; m_modalData = NULL;
m_endModalCalled = false; m_endModalCalled = false;
#if wxUSE_TOOLBAR && defined(__POCKETPC__)
m_dialogToolBar = NULL;
#endif
} }
bool wxDialog::Create(wxWindow *parent, bool wxDialog::Create(wxWindow *parent,
@@ -187,6 +194,9 @@ bool wxDialog::Create(wxWindow *parent,
#if defined(__SMARTPHONE__) && defined(__WXWINCE__) #if defined(__SMARTPHONE__) && defined(__WXWINCE__)
SetLeftMenu(wxID_OK, _("OK")); SetLeftMenu(wxID_OK, _("OK"));
#endif #endif
#if wxUSE_TOOLBAR && defined(__POCKETPC__)
CreateToolBar();
#endif
return true; return true;
} }
@@ -457,6 +467,25 @@ bool wxDialog::DoOK()
} }
#endif #endif
#if wxUSE_TOOLBAR && defined(__POCKETPC__)
// create main toolbar by calling OnCreateToolBar()
wxToolBar* wxDialog::CreateToolBar(long style, wxWindowID winid, const wxString& name)
{
m_dialogToolBar = OnCreateToolBar(style, winid, name);
return m_dialogToolBar;
}
// return a new toolbar
wxToolBar *wxDialog::OnCreateToolBar(long style,
wxWindowID winid,
const wxString& name)
{
return new wxToolMenuBar(this, winid,
wxDefaultPosition, wxDefaultSize,
style, name);
}
#endif
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// dialog window proc // dialog window proc

View File

@@ -148,10 +148,6 @@ void wxTopLevelWindowMSW::Init()
#if defined(__SMARTPHONE__) && defined(__WXWINCE__) #if defined(__SMARTPHONE__) && defined(__WXWINCE__)
m_MenuBarHWND = 0; m_MenuBarHWND = 0;
#endif #endif
#ifdef __POCKETPC__
// A dummy menubar for dialogs
m_menuBarHWND = 0;
#endif
} }
WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const
@@ -419,27 +415,6 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate,
::SetWindowText(GetHwnd(), title); ::SetWindowText(GetHwnd(), title);
} }
#ifdef __POCKETPC__
// Create an empty menubar so that we don't see the menubar underneath
SHMENUBARINFO mbi;
memset (&mbi, 0, sizeof (SHMENUBARINFO));
mbi.cbSize = sizeof (SHMENUBARINFO);
mbi.hwndParent = (HWND) GetParent()->GetHWND();
mbi.nToolBarId = 5000;
mbi.nBmpId = 0;
mbi.cBmpImages = 0;
mbi.dwFlags = 0 ; // SHCMBF_EMPTYBAR;
mbi.hInstRes = wxGetInstance();
if (!SHCreateMenuBar(&mbi))
{
wxFAIL_MSG( _T("SHCreateMenuBar failed") );
}
m_menuBarHWND = (WXHWND) mbi.hwndMB;
#endif
SubclassWin(m_hWnd); SubclassWin(m_hWnd);
#ifdef __SMARTPHONE__ #ifdef __SMARTPHONE__
@@ -588,15 +563,6 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent,
wxTopLevelWindowMSW::~wxTopLevelWindowMSW() wxTopLevelWindowMSW::~wxTopLevelWindowMSW()
{ {
#ifdef __POCKETPC__
// Destroy the dummy menubar for dialogs
if (m_menuBarHWND)
{
::DestroyWindow((HWND) m_menuBarHWND);
m_menuBarHWND = 0;
}
#endif
// after destroying an owned window, Windows activates the next top level // after destroying an owned window, Windows activates the next top level
// window in Z order but it may be different from our owner (to reproduce // window in Z order but it may be different from our owner (to reproduce
// this simply Alt-TAB to another application and back before closing the // this simply Alt-TAB to another application and back before closing the

View File

@@ -414,7 +414,7 @@ bool wxToolMenuBar::Realize()
wxBitmap bmpToUse = bmp; wxBitmap bmpToUse = bmp;
if (bmp.GetWidth() < 16 || bmp.GetHeight() < 16) if (bmp.GetWidth() < 16 || bmp.GetHeight() < 16 || bmp.GetMask() != NULL)
{ {
wxMemoryDC memDC; wxMemoryDC memDC;
wxBitmap b(16,16); wxBitmap b(16,16);