Allow MSW Base be usable in other ports than wxMSW (ie. wxTVision in windows console). Adjustements for limited setup.h (as in wxTV) and minor source cleaning.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34632 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-06-10 17:53:19 +00:00
parent 97bdb4c890
commit 532d575bd9
18 changed files with 117 additions and 57 deletions

View File

@@ -142,11 +142,12 @@ public:
// include the platform-specific version of the class
// ----------------------------------------------------------------------------
// NB: test for __UNIX__ before __WXMAC__ as under Darwin we want to use the
// Unix code (and otherwise __UNIX__ wouldn't be defined)
// NB: test for __UNIX__ before __WXMAC__ as under Darwin we want to use the
// Unix code (and otherwise __UNIX__ wouldn't be defined)
// ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port
#if defined(__WXPALMOS__)
#include "wx/palmos/apptbase.h"
#elif defined(__WXMSW__)
#elif defined(__WIN32__)
#include "wx/msw/apptbase.h"
#elif defined(__UNIX__) && !defined(__EMX__)
#include "wx/unix/apptbase.h"
@@ -229,9 +230,10 @@ public:
// include the platform-specific version of the classes above
// ----------------------------------------------------------------------------
// ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port
#if defined(__WXPALMOS__)
#include "wx/palmos/apptrait.h"
#elif defined(__WXMSW__)
#elif defined(__WIN32__)
#include "wx/msw/apptrait.h"
#elif defined(__UNIX__) && !defined(__EMX__)
#include "wx/unix/apptrait.h"

View File

@@ -240,7 +240,8 @@
it always returns false in other cases.
*/
#ifdef __cplusplus
#if defined(__WXMAC__) || defined(__WXMSW__)
/* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */
#if defined(__WXMAC__) || defined(__WIN32__)
extern bool WXDLLIMPEXP_BASE wxIsDebuggerRunning();
#else /* !Mac */
inline bool wxIsDebuggerRunning() { return false; }

View File

@@ -2466,7 +2466,8 @@ typedef WXWINHANDLE WXWidget;
#endif /* __WXPALMOS__ */
#if defined(__WXMSW__)
/* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */
#if defined(__WIN32__)
/* the keywords needed for WinMain() declaration */
#ifndef WXFAR
@@ -2518,12 +2519,12 @@ typedef long WXLPARAM;
typedef long WXLRESULT;
#endif
#if !defined(__WIN32__) || defined(__GNUWIN32__) || defined(__WXMICROWIN__)
#if defined(__GNUWIN32__) || defined(__WXMICROWIN__)
typedef int (*WXFARPROC)();
#else
typedef int (__stdcall *WXFARPROC)();
#endif
#endif /* __WXMSW__ */
#endif /* __WIN32__ */
#if defined(__WXPM__) || defined(__EMX__)

View File

@@ -16,6 +16,10 @@
#pragma interface "propdlg.h"
#endif
#include "wx/defs.h"
#if wxUSE_BOOKCTRL
class WXDLLEXPORT wxBookCtrlBase;
//-----------------------------------------------------------------------------
@@ -112,5 +116,7 @@ protected:
DECLARE_EVENT_TABLE()
};
#endif // wxUSE_BOOKCTRL
#endif // _WX_PROPDLG_H_

View File

@@ -193,7 +193,10 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_FIND_CLOSE(wxID_ANY, MyFrame::OnFindDialog)
#endif // wxUSE_FINDREPLDLG
#if USE_SETTINGS_DIALOG
EVT_MENU(DIALOGS_PROPERTY_SHEET, MyFrame::OnPropertySheet)
#endif
EVT_MENU(DIALOGS_REQUEST, MyFrame::OnRequestUserAttention)
EVT_MENU(wxID_EXIT, MyFrame::OnExit)
@@ -357,7 +360,10 @@ bool MyApp::OnInit()
file_menu->Append(wxID_ANY,_T("&Modal/Modeless"),modal_menu);
#endif // USE_MODAL_PRESENTATION
#if USE_SETTINGS_DIALOG
file_menu->Append(DIALOGS_PROPERTY_SHEET, _T("&Property Sheet Dialog\tCtrl-P"));
#endif
file_menu->Append(DIALOGS_REQUEST, _T("&Request user attention\tCtrl-R"));
file_menu->AppendSeparator();
@@ -964,11 +970,13 @@ void MyFrame::ShowTip(wxCommandEvent& WXUNUSED(event))
}
#endif // wxUSE_STARTUP_TIPS
#if USE_SETTINGS_DIALOG
void MyFrame::OnPropertySheet(wxCommandEvent& WXUNUSED(event))
{
SettingsDialog dialog(this);
dialog.ShowModal();
}
#endif // USE_SETTINGS_DIALOG
void MyFrame::OnRequestUserAttention(wxCommandEvent& WXUNUSED(event))
{
@@ -1356,6 +1364,7 @@ void MyModalDialog::OnButton(wxCommandEvent& event)
#endif // USE_MODAL_PRESENTATION
#if USE_SETTINGS_DIALOG
// ----------------------------------------------------------------------------
// SettingsDialog
// ----------------------------------------------------------------------------
@@ -1369,7 +1378,7 @@ SettingsDialog::SettingsDialog(wxWindow* win)
{
SetExtraStyle(wxDIALOG_EX_CONTEXTHELP|wxWS_EX_VALIDATE_RECURSIVELY);
Create(win, -1, _("Preferences"), wxDefaultPosition, wxDefaultSize,
Create(win, wxID_ANY, _("Preferences"), wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE
#ifndef __WXWINCE__
|wxRESIZE_BORDER
@@ -1412,7 +1421,7 @@ wxPanel* SettingsDialog::CreateGeneralSettingsPage(wxWindow* parent)
#if wxUSE_SPINCTRL
wxSpinCtrl* spinCtrl12 = new wxSpinCtrl(panel, ID_AUTO_SAVE_MINS, wxEmptyString,
wxDefaultPosition, wxSize(40, -1), wxSP_ARROW_KEYS, 1, 60, 1);
wxDefaultPosition, wxSize(40, wxDefaultCoord), wxSP_ARROW_KEYS, 1, 60, 1);
#endif
itemSizer12->Add(checkBox12, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
@@ -1459,7 +1468,7 @@ wxPanel* SettingsDialog::CreateAestheticSettingsPage(wxWindow* parent)
wxArrayString backgroundStyleChoices;
backgroundStyleChoices.Add(wxT("Colour"));
backgroundStyleChoices.Add(wxT("Image"));
wxStaticBox* staticBox3 = new wxStaticBox(panel, -1, _("Background style:"));
wxStaticBox* staticBox3 = new wxStaticBox(panel, wxID_ANY, _("Background style:"));
wxBoxSizer* styleSizer = new wxStaticBoxSizer( staticBox3, wxVERTICAL );
item0->Add(styleSizer, 0, wxGROW|wxALL, 5);
@@ -1477,11 +1486,11 @@ wxPanel* SettingsDialog::CreateAestheticSettingsPage(wxWindow* parent)
#if wxUSE_SPINCTRL
//// FONT SIZE SELECTION
wxStaticBox* staticBox1 = new wxStaticBox(panel, -1, _("Tile font size:"));
wxStaticBox* staticBox1 = new wxStaticBox(panel, wxID_ANY, _("Tile font size:"));
wxBoxSizer* itemSizer5 = new wxStaticBoxSizer( staticBox1, wxHORIZONTAL );
wxSpinCtrl* spinCtrl = new wxSpinCtrl(panel, ID_FONT_SIZE, wxEmptyString, wxDefaultPosition,
wxSize(80, -1));
wxSize(80, wxDefaultCoord));
itemSizer5->Add(spinCtrl, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
item0->Add(itemSizer5, 0, wxGROW|wxLEFT|wxRIGHT, 5);
@@ -1496,3 +1505,4 @@ wxPanel* SettingsDialog::CreateAestheticSettingsPage(wxWindow* parent)
return panel;
}
#endif // USE_SETTINGS_DIALOG

View File

@@ -78,13 +78,21 @@ of MSW, MAC and OS2
// Turn USE_MODAL_PRESENTATION to 0 if there is any reason for not presenting difference
// between modal and modeless dialogs (ie. not implemented it in your port yet)
#if defined(__SMARTPHONE__)
#if defined(__SMARTPHONE__) || !wxUSE_BOOKCTRL
#define USE_MODAL_PRESENTATION 0
#else
#define USE_MODAL_PRESENTATION 1
#endif
// Turn USE_SETTINGS_DIALOG to 0 if supported
#if wxUSE_BOOKCTRL
#define USE_SETTINGS_DIALOG 1
#else
#define USE_SETTINGS_DIALOG 0
#endif
// Define a new application type
class MyApp: public wxApp
{
@@ -128,6 +136,7 @@ private:
#endif // USE_MODAL_PRESENTATION
#if USE_SETTINGS_DIALOG
// Property sheet dialog
class SettingsDialog: public wxPropertySheetDialog
{
@@ -154,6 +163,8 @@ protected:
DECLARE_EVENT_TABLE()
};
#endif // USE_SETTINGS_DIALOG
// Define a new frame type
class MyFrame: public wxFrame
{

View File

@@ -438,8 +438,10 @@ MyFrame::MyFrame()
menuMenu->AppendSeparator();
menuMenu->Append(Menu_Menu_GetInfo, _T("Get menu item in&fo\tAlt-F"),
_T("Show the state of the last menu item"));
#if wxUSE_TEXTDLG
menuMenu->Append(Menu_Menu_SetLabel, _T("Set menu item label\tAlt-L"),
_T("Set the label of a menu item"));
#endif
#if wxUSE_TEXTDLG
menuMenu->AppendSeparator();
menuMenu->Append(Menu_Menu_FindItem, _T("Find menu item from label"),
@@ -480,7 +482,7 @@ MyFrame::MyFrame()
#if USE_LOG_WINDOW
// create the log text window
m_textctrl = new wxTextCtrl(this, wxID_ANY, _T(""),
m_textctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString,
wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE);
m_textctrl->SetEditable(false);
@@ -679,7 +681,7 @@ void MyFrame::OnFindMenu(wxCommandEvent& WXUNUSED(event))
(
_T("Enter label to search for: "),
_T("Find menu"),
_T(""),
wxEmptyString,
this
);
@@ -747,7 +749,7 @@ void MyFrame::OnInsertMenuItem(wxCommandEvent& WXUNUSED(event))
menu->Insert(0, wxMenuItem::New(menu, Menu_Dummy_Fourth,
_T("Fourth dummy item\tCtrl-F4")));
menu->Insert(1, wxMenuItem::New(menu, wxID_SEPARATOR, _T("")));
menu->Insert(1, wxMenuItem::New(menu, wxID_SEPARATOR));
}
void MyFrame::OnEnableMenuItem(wxCommandEvent& WXUNUSED(event))
@@ -898,7 +900,7 @@ void MyFrame::OnFindMenuItem(wxCommandEvent& WXUNUSED(event))
(
_T("Enter label to search for: "),
_T("Find menu item"),
_T(""),
wxEmptyString,
this
);

View File

@@ -252,6 +252,9 @@ wxBitmap wxDefaultArtProvider::CreateBitmap(const wxArtID& id,
}
}
}
#else
wxUnusedVar(client);
wxUnusedVar(reqSize);
#endif // wxUSE_IMAGE
return bmp;

View File

@@ -52,7 +52,7 @@
#include <stdarg.h>
#include <stdio.h>
#if defined(__WXMSW__)
#if defined(__WINDOWS__)
#include "wx/msw/private.h"
#endif
#ifdef __WXMAC__

View File

@@ -40,11 +40,8 @@
#if wxUSE_WCHAR_T
#ifdef __WXMSW__
#include "wx/msw/private.h"
#endif
#ifdef __WINDOWS__
#include "wx/msw/private.h"
#include "wx/msw/missing.h"
#endif

View File

@@ -533,6 +533,8 @@ long wxExecute(const wxString& command,
bool wxLaunchDefaultBrowser(const wxString& url)
{
bool success = true;
wxString finalurl = url;
//if it isn't a full url, try appending http:// to it
@@ -619,7 +621,7 @@ bool wxLaunchDefaultBrowser(const wxString& url)
// Windows sometimes doesn't open the browser correctly when using mime
// types, so do ShellExecute - i.e. start <url> (from James Carroll)
nResult = (int) (*lpShellExecute)(NULL, NULL, finalurl.c_str(),
NULL, wxT(""), SW_SHOWNORMAL);
NULL, wxT(""), SW_SHOWNORMAL);
// Unload Shell32.dll
::FreeLibrary(hShellDll);
#else
@@ -705,12 +707,12 @@ bool wxLaunchDefaultBrowser(const wxString& url)
#else // !wxUSE_MIMETYPE && !(WXMSW && wxUSE_NATIVE_CONFIG)
return false;
success = false;
#endif
//success - hopefully
return true;
return success;
}
// ----------------------------------------------------------------------------

View File

@@ -22,6 +22,8 @@
#include "wx/defs.h"
#if wxUSE_BOOKCTRL
#ifndef WX_PRECOMP
#include "wx/button.h"
#include "wx/sizer.h"
@@ -150,3 +152,4 @@ void wxPropertySheetDialog::OnActivate(wxActivateEvent& event)
event.Skip();
}
#endif // wxUSE_BOOKCTRL

View File

@@ -36,7 +36,7 @@
#include "wx/dir.h"
#include "wx/filefn.h" // for wxDirExists()
#ifdef __WXMSW__
#ifdef __WINDOWS__
#include "wx/msw/private.h"
#endif

View File

@@ -251,7 +251,7 @@ int wxEntry(int& argc, wxChar **argv)
#endif // wxUSE_BASE
#if wxUSE_GUI
#if wxUSE_GUI && defined(__WXMSW__)
// ----------------------------------------------------------------------------
// Windows-specific wxEntry
@@ -370,7 +370,7 @@ DllMain(HINSTANCE hModule, DWORD fdwReason, LPVOID WXUNUSED(lpReserved))
#endif // !NOMAIN
#endif // wxUSE_GUI
#endif // wxUSE_GUI && __WXMSW__
// ----------------------------------------------------------------------------
// global HINSTANCE

View File

@@ -163,7 +163,7 @@ wxRegKey::StdKey wxRegKey::ExtractKeyName(wxString& strKey)
}
else {
strKey = strKey.After(REG_SEPARATOR);
if ( !strKey.IsEmpty() && strKey.Last() == REG_SEPARATOR )
if ( !strKey.empty() && strKey.Last() == REG_SEPARATOR )
strKey.Truncate(strKey.Len() - 1);
}
@@ -214,8 +214,8 @@ wxRegKey::wxRegKey(const wxRegKey& keyParent, const wxString& strKey)
: m_strKey(keyParent.m_strKey)
{
// combine our name with parent's to get the full name
if ( !m_strKey.IsEmpty() &&
(strKey.IsEmpty() || strKey[0] != REG_SEPARATOR) ) {
if ( !m_strKey.empty() &&
(strKey.empty() || strKey[0] != REG_SEPARATOR) ) {
m_strKey += REG_SEPARATOR;
}
@@ -270,7 +270,7 @@ void wxRegKey::SetName(const wxRegKey& keyParent, const wxString& strKey)
// next line!
m_strKey.clear();
m_strKey += keyParent.m_strKey;
if ( !strKey.IsEmpty() && strKey[0] != REG_SEPARATOR )
if ( !strKey.empty() && strKey[0] != REG_SEPARATOR )
m_strKey += REG_SEPARATOR;
m_strKey += strKey;
@@ -304,7 +304,7 @@ wxString wxRegKey::GetName(bool bShortPrefix) const
StdKey key = GetStdKeyFromHkey((WXHKEY) m_hRootKey);
wxString str = bShortPrefix ? aStdKeys[key].szShortName
: aStdKeys[key].szName;
if ( !m_strKey.IsEmpty() )
if ( !m_strKey.empty() )
str << _T("\\") << m_strKey;
return str;
@@ -523,7 +523,7 @@ bool wxRegKey::CopyValue(const wxChar *szValue,
bool wxRegKey::Rename(const wxChar *szNewName)
{
wxCHECK_MSG( !m_strKey.IsEmpty(), false, _T("registry hives can't be renamed") );
wxCHECK_MSG( !m_strKey.empty(), false, _T("registry hives can't be renamed") );
if ( !Exists() ) {
wxLogError(_("Registry key '%s' does not exist, cannot rename it."),
@@ -541,7 +541,7 @@ bool wxRegKey::Rename(const wxChar *szNewName)
if ( inSameHive ) {
// rename the key to the new name under the same parent
wxString strKey = m_strKey.BeforeLast(REG_SEPARATOR);
if ( !strKey.IsEmpty() ) {
if ( !strKey.empty() ) {
// don't add '\\' in the start if strFullNewName is empty
strKey += REG_SEPARATOR;
}
@@ -655,7 +655,7 @@ bool wxRegKey::DeleteSelf()
// prevent a buggy program from erasing one of the root registry keys or an
// immediate subkey (i.e. one which doesn't have '\\' inside) of any other
// key except HKCR (HKCR has some "deleteable" subkeys)
if ( m_strKey.IsEmpty() ||
if ( m_strKey.empty() ||
((m_hRootKey != (WXHKEY) aStdKeys[HKCR].hkey) &&
(m_strKey.Find(REG_SEPARATOR) == wxNOT_FOUND)) ) {
wxLogError(_("Registry key '%s' is needed for normal system operation,\ndeleting it will leave your system in unusable state:\noperation aborted."),
@@ -1096,6 +1096,8 @@ bool wxRegKey::IsNumericValue(const wxChar *szValue) const
// exporting registry keys to file
// ----------------------------------------------------------------------------
#if wxUSE_STREAMS
// helper functions for writing ASCII strings (even in Unicode build)
static inline bool WriteAsciiChar(wxOutputStream& ostr, char ch)
{
@@ -1126,8 +1128,11 @@ static inline bool WriteAsciiString(wxOutputStream& ostr, const wxString& s)
return ostr.IsOk();
}
#endif // wxUSE_STREAMS
bool wxRegKey::Export(const wxString& filename) const
{
#if wxUSE_FFILE && wxUSE_STREAMS
if ( wxFile::Exists(filename) )
{
wxLogError(_("Exporting registry key: file \"%s\" already exists and won't be overwritten."),
@@ -1138,8 +1143,13 @@ bool wxRegKey::Export(const wxString& filename) const
wxFFileOutputStream ostr(filename, _T("w"));
return ostr.Ok() && Export(ostr);
#else
wxUnusedVar(filename);
return false;
#endif
}
#if wxUSE_STREAMS
bool wxRegKey::Export(wxOutputStream& ostr) const
{
// write out the header
@@ -1148,6 +1158,7 @@ bool wxRegKey::Export(wxOutputStream& ostr) const
return DoExport(ostr);
}
#endif // wxUSE_STREAMS
static
wxString
@@ -1278,6 +1289,8 @@ wxString wxRegKey::FormatValue(const wxString& name) const
return rhs;
}
#if wxUSE_STREAMS
bool wxRegKey::DoExportValue(wxOutputStream& ostr, const wxString& name) const
{
// first examine the value type: if it's unsupported, simply skip it
@@ -1357,6 +1370,8 @@ bool wxRegKey::DoExport(wxOutputStream& ostr) const
return true;
}
#endif // wxUSE_STREAMS
// ============================================================================
// implementation of global private functions
// ============================================================================
@@ -1397,7 +1412,7 @@ const wxChar *GetFullName(const wxRegKey *pKey, const wxChar *szValue)
void RemoveTrailingSeparator(wxString& str)
{
if ( !str.IsEmpty() && str.Last() == REG_SEPARATOR )
if ( !str.empty() && str.Last() == REG_SEPARATOR )
str.Truncate(str.Len() - 1);
}

View File

@@ -1069,6 +1069,7 @@ void wxBell()
bool wxIsDebuggerRunning()
{
#if wxUSE_DYNLIB_CLASS
// IsDebuggerPresent() is not available under Win95, so load it dynamically
wxDynamicLibrary dll(_T("kernel32.dll"), wxDL_VERBATIM);
@@ -1080,6 +1081,9 @@ bool wxIsDebuggerRunning()
}
return (*(IsDebuggerPresent_t)dll.GetSymbol(_T("IsDebuggerPresent")))() != 0;
#else
return false;
#endif
}
// ----------------------------------------------------------------------------

View File

@@ -25,8 +25,9 @@
<install-to>$(BINDIR)</install-to>
</exe>
<exe id="tex2rtf_gui" template="wx_util" template_append="wx_append"
cond="USE_GUI=='1'">
<exe id="tex2rtf_gui" template="wx_util"
template_append="wx_append"
cond="USE_GUI=='1'">
<sources>$(TEX2RTF_SRC)</sources>
<wx-lib>html</wx-lib>
<wx-lib>core</wx-lib>

View File

@@ -1631,7 +1631,7 @@ void InitialiseColourTable(void)
void Tex2RTFYield(bool force)
{
#ifdef __WXMSW__
#ifdef __WINDOWS__
static int yieldCount = 0;
if (isSync)
@@ -1646,6 +1646,8 @@ void Tex2RTFYield(bool force)
yieldCount = 10;
}
yieldCount --;
#else
wxUnusedVar(force);
#endif
}