⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wxmsw.tex

📁 很牛的GUI源码wxWidgets-2.8.0.zip 可在多种平台下运行.
💻 TEX
📖 第 1 页 / 共 2 页
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Name:        wxmsw.tex%% Purpose:     wxMSW and wxWinCE platform specific informations%% Author:      wxWidgets Team%% Modified by:%% Created:%% RCS-ID:      $Id: wxmsw.tex,v 1.31 2006/10/10 17:46:49 JS Exp $%% Copyright:   (c) wxWidgets Team%% License:     wxWindows license%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\section{wxMSW port}\label{wxmswport}wxMSW is a port of wxWidgets for the Windows platformsincluding Windows 95, 98, ME, 2000, NT, XP in ANSI andUnicode mode (for Windows 95 through the MSLU extensionlibrary). wxMSW ensures native look and feel for XPas well when using wxWidgets version 2.3.3 or higher.wxMSW can be compile with a great variety of compilersincluding MS VC++, Borland 5.5, MinGW32, Cygwin andWatcom as well as cross-compilation with a Linux hostedMinGW32 tool chain.For further information, please see the files in docs/mswin the distribution.\subsection{wxWinCE}\label{wxwince}wxWinCE is the name given to wxMSW when compiled on Windows CE devices;most of wxMSW is common to Win32 and Windows CE but there aresome simplifications, enhancements, and differences inbehaviour.For building instructions, see docs/msw/wince in thedistribution, also the section about Visual Studio 2005 projectfiles below. The rest of this section documents issues youneed to be aware of when programming for Windows CE devices.\subsubsection{General issues for wxWinCE programming}Mobile applications generally have fewer features andsimpler user interfaces. Simply omit whole sizers, staticlines and controls in your dialogs, and use comboboxes insteadof listboxes where appropriate. You also need to reducethe amount of spacing used by sizers, for which you canuse a macro such as this:\begin{verbatim}#if defined(__WXWINCE__)    #define wxLARGESMALL(large,small) small#else    #define wxLARGESMALL(large,small) large#endif// Usagetopsizer->Add( CreateTextSizer( message ), 0, wxALL, wxLARGESMALL(10,0) );\end{verbatim}There is only ever one instance of a Windows CE application running,and wxWidgets will take care of showing the current instance andshutting down the second instance if necessary.You can test the return value of wxSystemSettings::GetScreenType()for a qualitative assessment of what kind of display is available,or use wxGetDisplaySize() if you need more information.You can also use wxGetOsVersion to test for a version of Windows CE atrun-time (see the next section). However, because different buildsare currently required to target different kinds of device, thesevalues are hard-wired according to the build, and you cannotdynamically adapt the same executable for different major Windows CEplatforms. This would require a different approach to the waywxWidgets adapts its behaviour (such as for menubars) to suit thestyle of device.See the "Life!" example (demos/life) for an example ofan application that has been tailored for PocketPC and Smartphone use.{\bf Note:} don't forget to have this line in your .rc file, as fordesktop Windows applications:\begin{verbatim}#include "wx/msw/wx.rc"\end{verbatim}\subsubsection{Testing for WinCE SDKs}Use these preprocessor symbols to test for the different types of device or SDK:\begin{twocollist}\itemsep=0pt\twocolitem{\_\_SMARTPHONE\_\_}{Generic mobile devices with phone buttons and a small display}\twocolitem{\_\_PDA\_\_}{Generic mobile devices with no phone}\twocolitem{\_\_HANDHELDPC\_\_}{Generic mobile device with a keyboard}\twocolitem{\_\_WXWINCE\_\_}{Microsoft-powered Windows CE devices, whether PocketPC, Smartphone or Standard SDK}\twocolitem{WIN32\_PLATFORM\_WFSP}{Microsoft-powered smartphone}\twocolitem{\_\_POCKETPC\_\_}{Microsoft-powered PocketPC devices with touch-screen}\twocolitem{\_\_WINCE\_STANDARDSDK\_\_}{Microsoft-powered Windows CE devices, for generic Windows CE applications}\twocolitem{\_\_WINCE\_NET\_\_}{Microsoft-powered Windows CE .NET devices (\_WIN32\_WCE is 400 or greater)}\end{twocollist}wxGetOsVersion will return these values:\begin{twocollist}\itemsep=0pt\twocolitem{wxWINDOWS\_POCKETPC}{The application is running under PocketPC.}\twocolitem{wxWINDOWS\_SMARTPHONE}{The application is running under Smartphone.}\twocolitem{wxWINDOWS\_CE}{The application is running under Windows CE (built with the Standard SDK).}\end{twocollist}\subsubsection{Window sizing in wxWinCE}Top level windows (dialogs, frames) are created always full-screen. Fit() of sizers will not rescale toplevel windows but instead will scale window content.If the screen orientation changes, the windows will automatically be resizedso no further action needs to be taken (unless you want to change the layoutaccording to the orientation, which you could detect in idle time, for example).When input panel (SIP) is shown, top level windows (frames and dialogs) resizeaccordingly (see \helpref{wxTopLevelWindow::HandleSettingChange}{wxtoplevelwindowhandlesettingchange}).\subsubsection{Closing top-level windows in wxWinCE}You won't get a wxCloseEvent when the user clicks on the X in the titlebaron Smartphone and PocketPC; the window is simply hidden instead. However the system may send theevent to force the application to close down.\subsubsection{Hibernation in wxWinCE}Smartphone and PocketPC will send a wxEVT\_HIBERNATE to the application object in lowmemory conditions. Your application should release memory and close dialogs,and wake up again when the next wxEVT\_ACTIVATE or wxEVT\_ACTIVATE\_APP message is received.(wxEVT\_ACTIVATE\_APP is generated whenever a wxEVT\_ACTIVATE event is receivedin Smartphone and PocketPC, since these platforms do not support WM\_ACTIVATEAPP.)\subsubsection{Hardware buttons in wxWinCE}Special hardware buttons are sent to a window via the wxEVT\_HOTKEY eventunder Smartphone and PocketPC. You should first register each required button with \helpref{wxWindow::RegisterHotKey}{wxwindowregisterhotkey},and unregister the button when you're done with it. For example:\begin{verbatim}  win->RegisterHotKey(0, wxMOD_WIN, WXK_SPECIAL1);  win->UnregisterHotKey(0);\end{verbatim}You may have to register the buttons in a wxEVT\_ACTIVATE event handlersince other applications will grab the buttons.There is currently no method of finding out the names of the specialbuttons or how many there are.\subsubsection{Dialogs in wxWinCE}PocketPC dialogs have an OK button on the caption, and so you should generallynot repeat an OK button on the dialog. You can add a Cancel button if necessary, but some dialogssimply don't offer you the choice (the guidelines recommend you offer an Undo facilityto make up for it). When the user clicks on the OK button, your dialog will receivea wxID\_OK event by default. If you wish to change this, call \helpref{wxDialog::SetAffirmativeId}{wxdialogsetaffirmativeid}with the required identifier to be used. Or, override \helpref{wxDialog::DoOK}{wxdialogdook} (return false tohave wxWidgets simply call Close to dismiss the dialog).Smartphone dialogs do {\it not} have an OK button on the caption, and are closedusing one of the two menu buttons. You need to assign these using \helpref{wxTopLevelWindow::SetLeftMenu}{wxtoplevelwindowsetleftmenu}and \helpref{wxTopLevelWindow::SetRightMenu}{wxtoplevelwindowsetrightmenu}, for example:\begin{verbatim}#ifdef __SMARTPHONE__    SetLeftMenu(wxID_OK);    SetRightMenu(wxID_CANCEL, _("Cancel"));#elif defined(__POCKETPC__)    // No OK/Cancel buttons on PocketPC, OK on caption will close#else    topsizer->Add( CreateButtonSizer( wxOK|wxCANCEL ), 0, wxEXPAND | wxALL, 10 );#endif\end{verbatim}For implementing property sheets (flat tabs), use a wxNotebook with wxNB\_FLAT|wxNB\_BOTTOMand have the notebook left, top and right sides overlap the dialog by about 3 pixelsto eliminate spurious borders. You can do this by using a negative spacing in yoursizer Add() call. The cross-platform property sheet dialog \helpref{wxPropertySheetDialog}{wxpropertysheetdialog} isprovided, to show settings in the correct style on PocketPC and on other platforms.Notifications (bubble HTML text with optional buttons and links) will also beimplemented in the future for PocketPC.Modeless dialogs probably don't make sense for PocketPC and Smartphone, sinceframes and dialogs are normally full-screen, and a modeless dialog is normallyintended to co-exist with the main application frame.\subsubsection{Menubars and toolbars in wxWinCE}\wxheading{Menubars and toolbars in PocketPC}On PocketPC, a frame must always have a menubar, even if it's empty.An empty menubar/toolbar is automatically provided for dialogs, to hideany existing menubar for the duration of the dialog.Menubars and toolbars are implemented using a combined control,but you can use essentially the usual wxWidgets API; wxWidgets will combine the menubarand toolbar. However, there are some restrictions:\itemsep=0pt\begin{itemize}\item You must create the frame's primary toolbar with wxFrame::CreateToolBar,because this uses the special wxToolMenuBar class (derived from wxToolBar)to implement the combined toolbar and menubar. Otherwise, you can create and manage toolbarsusing the wxToolBar class as usual, for example to implement an optionalformatting toolbar above the menubar as Pocket Word does. But don't assigna wxToolBar to a frame using SetToolBar - you should always use CreateToolBarfor the main frame toolbar.\item Deleting and adding tools to wxToolMenuBar after Realize is called is not supported.\item For speed, colours are not remapped to the system colours as they arein wxMSW. Provide the tool bitmaps either with the correct system button background,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -