fixes for building wxMSW with --disbale-all-features

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47608 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2007-07-21 02:05:03 +00:00
parent 5d18e02915
commit a8ff046ba9
16 changed files with 107 additions and 38 deletions

View File

@ -11,6 +11,8 @@
#ifndef _WX_MSW_PRIVATE_TIMER_H_
#define _WX_MSW_PRIVATE_TIMER_H_
#if wxUSE_TIMER
#include "wx/private/timer.h"
class WXDLLIMPEXP_BASE wxMSWTimerImpl : public wxTimerImpl
@ -27,4 +29,6 @@ protected:
unsigned long m_id;
};
#endif // wxUSE_TIMER
#endif // _WX_TIMERH_

View File

@ -21,6 +21,7 @@ public:
wxRegion(const wxRect& rect);
wxRegion(WXHRGN hRegion); // Hangs on to this region
wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
#if wxUSE_IMAGE
wxRegion( const wxBitmap& bmp)
{
Union(bmp);
@ -30,6 +31,7 @@ public:
{
Union(bmp, transColour, tolerance);
}
#endif // wxUSE_IMAGE
virtual ~wxRegion();

View File

@ -18,7 +18,11 @@
// Enables an application to influence the wxWidgets implementation
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxSystemOptions : public wxObject
class
#if wxUSE_SYSTEM_OPTIONS
WXDLLIMPEXP_BASE
#endif
wxSystemOptions : public wxObject
{
public:
wxSystemOptions() { }

View File

@ -456,8 +456,10 @@ wxMessageOutput *wxGUIAppTraitsBase::CreateMessageOutput()
// wxMessageOutputMessageBox doesn't work under Motif
#ifdef __WXMOTIF__
return new wxMessageOutputLog;
#else
#elif wxUSE_MSGDLG
return new wxMessageOutputMessageBox;
#else
return new wxMessageOutputStderr;
#endif
#endif // __UNIX__/!__UNIX__
}

View File

@ -149,7 +149,7 @@ void wxControlContainer::SetLastFocus(wxWindow *win)
// within the same group. Used by wxSetFocusToChild on wxMSW
// --------------------------------------------------------------------
#ifdef __WXMSW__
#if defined(__WXMSW__) && wxUSE_RADIOBTN
wxRadioButton* wxGetPreviousButtonInGroup(wxRadioButton *btn)
{
@ -372,12 +372,12 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event )
if ( winFocus )
{
#ifdef __WXMSW__
#if defined(__WXMSW__) && wxUSE_RADIOBTN
// If we are in a radio button group, start from the first item in the
// group
if ( event.IsFromTab() && wxIsKindOf(winFocus, wxRadioButton ) )
winFocus = wxGetFirstButtonInGroup((wxRadioButton*)winFocus);
#endif
#endif // __WXMSW__
// ok, we found the focus - now is it our child?
start_node = children.Find( winFocus );
}
@ -451,7 +451,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event )
wxWindow *child = node->GetData();
#ifdef __WXMSW__
#if defined(__WXMSW__) && wxUSE_RADIOBTN
if ( event.IsFromTab() )
{
if ( wxIsKindOf(child, wxRadioButton) )
@ -654,7 +654,7 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused)
if ( child->CanAcceptFocusFromKeyboard() && !child->IsTopLevel() )
{
#ifdef __WXMSW__
#if defined(__WXMSW__) && wxUSE_RADIOBTN
// If a radiobutton is the first focusable child, search for the
// selected radiobutton in the same group
wxRadioButton* btn = wxDynamicCast(child, wxRadioButton);
@ -664,7 +664,7 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused)
if (selected)
child = selected;
}
#endif
#endif // __WXMSW__
wxLogTrace(TRACE_FOCUS,
_T("SetFocusToChild() => first child (0x%p)."),

View File

@ -34,6 +34,7 @@
#include "wx/module.h"
#if wxUSE_GUI
#include "wx/window.h"
#include "wx/control.h"
#include "wx/dc.h"
#include "wx/textctrl.h"

View File

@ -266,11 +266,15 @@ wxPortId wxGUIAppTraits::GetToolkitVersion(int *majVer, int *minVer) const
#endif
}
#if wxUSE_TIMER
wxTimerImpl *wxGUIAppTraits::CreateTimerImpl(wxTimer *timer)
{
return new wxMSWTimerImpl(timer);
}
#endif // wxUSE_TIMER
wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
{
return new wxEventLoop;

View File

@ -82,16 +82,24 @@ bool wxConsoleAppTraits::DoMessageFromThreadWait()
return true;
}
#if wxUSE_TIMER
wxTimerImpl *wxConsoleAppTraits::CreateTimerImpl(wxTimer *timer)
{
return new wxMSWTimerImpl(timer);
}
#endif // wxUSE_TIMER
#if wxUSE_CONSOLE_EVENTLOOP
wxEventLoopBase *wxConsoleAppTraits::CreateEventLoop()
{
return new wxEventLoop();
}
#endif // wxUSE_CONSOLE_EVENTLOOP
WXDWORD wxConsoleAppTraits::WaitForThread(WXHANDLE hThread)
{
return DoSimpleWaitForThread(hThread);

View File

@ -205,6 +205,8 @@ private:
DECLARE_NO_COPY_CLASS(StretchBltModeChanger)
};
#if wxUSE_DYNLIB_CLASS
// helper class to cache dynamically loaded libraries and not attempt reloading
// them if it fails
class wxOnceOnlyDLLLoader
@ -244,6 +246,8 @@ private:
static wxOnceOnlyDLLLoader wxGDI32DLL(_T("gdi32"));
static wxOnceOnlyDLLLoader wxMSIMG32DLL(_T("msimg32"));
#endif // wxUSE_DYNLIB_CLASS
// ===========================================================================
// implementation
// ===========================================================================
@ -2673,6 +2677,8 @@ void wxDC::DoGradientFillLinear (const wxRect& rect,
wxDCBase::DoGradientFillLinear(rect, initialColour, destColour, nDirection);
}
#if wxUSE_DYNLIB_CLASS
static DWORD wxGetDCLayout(HDC hdc)
{
typedef DWORD (WINAPI *GetLayout_t)(HDC);
@ -2715,3 +2721,17 @@ void wxDC::SetLayoutDirection(wxLayoutDirection dir)
pfnSetLayout(GetHdc(), layout);
}
#else // !wxUSE_DYNLIB_CLASS
// we can't provide RTL support without dynamic loading, so stub it out
wxLayoutDirection wxDC::GetLayoutDirection() const
{
return wxLayout_Default;
}
void wxDC::SetLayoutDirection(wxLayoutDirection WXUNUSED(dir))
{
}
#endif // wxUSE_DYNLIB_CLASS/!wxUSE_DYNLIB_CLASS

View File

@ -307,6 +307,7 @@ bool wxDIB::Save(const wxString& filename)
{
wxCHECK_MSG( m_handle, false, _T("wxDIB::Save(): invalid object") );
#if wxUSE_FILE
wxFile file(filename, wxFile::write);
bool ok = file.IsOpened();
if ( ok )
@ -335,6 +336,9 @@ bool wxDIB::Save(const wxString& filename)
file.Write(ds.dsBm.bmBits, sizeImage) == sizeImage;
}
}
#else // !wxUSE_FILE
bool ok = false;
#endif // wxUSE_FILE/!wxUSE_FILE
if ( !ok )
{

View File

@ -201,7 +201,7 @@ bool wxDirData::Read(wxString *filename)
if ( err != ERROR_FILE_NOT_FOUND && err != ERROR_NO_MORE_FILES )
{
wxLogSysError(err, _("Can not enumerate files in directory '%s'"),
wxLogSysError(err, wxString(_("Can not enumerate files in directory '%s'")),
m_dirname.c_str());
}
#endif // __WIN32__

View File

@ -563,6 +563,7 @@ bool wxFrame::ShowFullScreen(bool show, long style)
}
#endif // wxUSE_TOOLBAR
#if wxUSE_MENUS
if (m_fsStyle & wxFULLSCREEN_NOMENUBAR)
{
WXHMENU menu = m_hMenu;
@ -584,6 +585,7 @@ bool wxFrame::ShowFullScreen(bool show, long style)
::SetMenu(GetHwnd(), (HMENU)menu);
}
}
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
wxStatusBar *theStatusBar = GetStatusBar();
@ -984,6 +986,8 @@ bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
return false;
}
#if wxUSE_MENUS
bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu)
{
int item;
@ -1025,6 +1029,30 @@ bool wxFrame::HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup)
return GetEventHandler()->ProcessEvent(event);
}
bool wxFrame::HandleInitMenuPopup(WXHMENU hMenu)
{
wxMenu* menu = NULL;
if (GetMenuBar())
{
int nCount = GetMenuBar()->GetMenuCount();
for (int n = 0; n < nCount; n++)
{
if (GetMenuBar()->GetMenu(n)->GetHMenu() == hMenu)
{
menu = GetMenuBar()->GetMenu(n);
break;
}
}
}
wxMenuEvent event(wxEVT_MENU_OPEN, 0, menu);
event.SetEventObject(this);
return GetEventHandler()->ProcessEvent(event);
}
#endif // wxUSE_MENUS
// ---------------------------------------------------------------------------
// the window proc for wxFrame
// ---------------------------------------------------------------------------
@ -1061,11 +1089,12 @@ WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPara
processed = HandlePaint();
break;
#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
#if wxUSE_MENUS
case WM_INITMENUPOPUP:
processed = HandleInitMenuPopup((WXHMENU) wParam);
break;
#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
case WM_MENUSELECT:
{
WXWORD item, flags;
@ -1079,6 +1108,7 @@ WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPara
case WM_EXITMENULOOP:
processed = HandleMenuLoop(wxEVT_MENU_CLOSE, (WXWORD)wParam);
break;
#endif // wxUSE_MENUS
case WM_QUERYDRAGICON:
{
@ -1098,29 +1128,6 @@ WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPara
return rc;
}
// handle WM_INITMENUPOPUP message
bool wxFrame::HandleInitMenuPopup(WXHMENU hMenu)
{
wxMenu* menu = NULL;
if (GetMenuBar())
{
int nCount = GetMenuBar()->GetMenuCount();
for (int n = 0; n < nCount; n++)
{
if (GetMenuBar()->GetMenu(n)->GetHMenu() == hMenu)
{
menu = GetMenuBar()->GetMenu(n);
break;
}
}
}
wxMenuEvent event(wxEVT_MENU_OPEN, 0, menu);
event.SetEventObject(this);
return GetEventHandler()->ProcessEvent(event);
}
// ----------------------------------------------------------------------------
// wxFrame size management: we exclude the areas taken by menu/status/toolbars
// from the client area, so the client area is what's really available for the

View File

@ -278,7 +278,7 @@ bool wxImageList::Draw(int index,
// Get the bitmap
wxBitmap wxImageList::GetBitmap(int index) const
{
#if wxUSE_WXDIB
#if wxUSE_WXDIB && wxUSE_IMAGE
int bmp_width = 0, bmp_height = 0;
GetSize(index, bmp_width, bmp_height);

View File

@ -16,6 +16,8 @@
#pragma hdrstop
#endif
#if wxUSE_MSGDLG
#include "wx/msgdlg.h"
#ifndef WX_PRECOMP
@ -132,3 +134,5 @@ int wxMessageDialog::ShowModal()
}
return ans;
}
#endif // wxUSE_MSGDLG

View File

@ -1087,7 +1087,7 @@ void wxTopLevelWindowMSW::RequestUserAttention(int flags)
// provide FlashWindowEx() declaration, so try to detect whether we have
// real headers for WINVER 0x0500 by checking for existence of a symbol not
// declated in MSVC6 header
#if defined(FLASHW_STOP) && defined(VK_XBUTTON1)
#if defined(FLASHW_STOP) && defined(VK_XBUTTON1) && wxUSE_DYNLIB_CLASS
// available in the headers, check if it is supported by the system
typedef BOOL (WINAPI *FlashWindowEx_t)(FLASHWINFO *pfwi);
FlashWindowEx_t s_pfnFlashWindowEx = NULL;
@ -1133,6 +1133,7 @@ void wxTopLevelWindowMSW::RequestUserAttention(int flags)
bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha)
{
#if wxUSE_DYNLIB_CLASS
typedef DWORD (WINAPI *PSETLAYEREDWINDOWATTR)(HWND, DWORD, BYTE, DWORD);
static PSETLAYEREDWINDOWATTR pSetLayeredWindowAttributes = NULL;
@ -1144,6 +1145,7 @@ bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha)
}
if ( pSetLayeredWindowAttributes == NULL )
return false;
#endif // wxUSE_DYNLIB_CLASS
LONG exstyle = GetWindowLong(GetHwnd(), GWL_EXSTYLE);
@ -1155,11 +1157,16 @@ bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha)
return true;
}
#if wxUSE_DYNLIB_CLASS
// Otherwise, set the layered style if needed and set the alpha value
if ((exstyle & WS_EX_LAYERED) == 0 )
SetWindowLong(GetHwnd(), GWL_EXSTYLE, exstyle | WS_EX_LAYERED);
return pSetLayeredWindowAttributes(GetHwnd(), 0, (BYTE)alpha, LWA_ALPHA) != 0;
if ( pSetLayeredWindowAttributes(GetHwnd(), 0, (BYTE)alpha, LWA_ALPHA) )
return true;
#endif // wxUSE_DYNLIB_CLASS
return false;
}
bool wxTopLevelWindowMSW::CanSetTransparent()

View File

@ -158,7 +158,7 @@ bool wxGetHostName(wxChar *WXUNUSED_IN_WINCE(buf),
// get full hostname (with domain name if possible)
bool wxGetFullHostName(wxChar *buf, int maxSize)
{
#if !defined( __WXMICROWIN__) && wxUSE_DYNAMIC_LOADER && wxUSE_SOCKETS
#if !defined( __WXMICROWIN__) && wxUSE_DYNLIB_CLASS && wxUSE_SOCKETS
// TODO should use GetComputerNameEx() when available
// we don't want to always link with Winsock DLL as we might not use it at
@ -1176,7 +1176,7 @@ bool wxIsPlatform64Bit()
{
#if defined(_WIN64)
return true; // 64-bit programs run only on Win64
#else // Win32
#elif wxUSE_DYNLIB_CLASS // Win32
// 32-bit programs run on both 32-bit and 64-bit Windows so check
typedef BOOL (WINAPI *IsWow64Process_t)(HANDLE, BOOL *);
@ -1192,6 +1192,8 @@ bool wxIsPlatform64Bit()
//else: running under a system without Win64 support
return wow64 != FALSE;
#else
return false;
#endif // Win64/Win32
}