Merge in from trunk r67662 to r64801

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68402 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Steve Lamerton
2011-07-25 16:54:53 +00:00
727 changed files with 42813 additions and 46104 deletions

View File

@@ -0,0 +1,81 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/anybutton.h
// Purpose: wxAnyButton class
// Author: Julian Smart
// Created: 1997-02-01 (extracted from button.h)
// RCS-ID: $Id: anybutton.h 67065 2011-02-27 12:48:26Z VZ $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_ANYBUTTON_H_
#define _WX_MSW_ANYBUTTON_H_
// ----------------------------------------------------------------------------
// Common button functionality
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase
{
public:
wxAnyButton()
{
m_imageData = NULL;
#if wxUSE_MARKUP
m_markupText = NULL;
#endif // wxUSE_MARKUP
}
virtual ~wxAnyButton();
// overridden base class methods
virtual void SetLabel(const wxString& label);
virtual bool SetBackgroundColour(const wxColour &colour);
virtual bool SetForegroundColour(const wxColour &colour);
// implementation from now on
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
virtual State GetNormalState() const { return State_Normal; }
// returns true if the platform should explicitly apply a theme border
virtual bool CanApplyThemeBorder() const { return false; }
protected:
// usually overridden base class virtuals
virtual wxSize DoGetBestSize() const;
virtual wxBitmap DoGetBitmap(State which) const;
virtual void DoSetBitmap(const wxBitmap& bitmap, State which);
virtual wxSize DoGetBitmapMargins() const;
virtual void DoSetBitmapMargins(wxCoord x, wxCoord y);
virtual void DoSetBitmapPosition(wxDirection dir);
#if wxUSE_MARKUP
virtual bool DoSetLabelMarkup(const wxString& markup);
#endif // wxUSE_MARKUP
// Increases the passed in size to account for the button image.
//
// Should only be called if we do have a button, i.e. if m_imageData is
// non-NULL.
void AdjustForBitmapSize(wxSize& size) const;
class wxButtonImageData *m_imageData;
#if wxUSE_MARKUP
class wxMarkupText *m_markupText;
#endif // wxUSE_MARKUP
// Switches button into owner-drawn mode: this is used if we need to draw
// something not supported by the native control, such as using non default
// colours or a bitmap on pre-XP systems.
void MakeOwnerDrawn();
bool IsOwnerDrawn() const;
private:
wxDECLARE_NO_COPY_CLASS(wxAnyButton);
};
#endif // _WX_MSW_ANYBUTTON_H_

View File

@@ -19,7 +19,7 @@
class WXDLLIMPEXP_CORE wxBitmapButton : public wxBitmapButtonBase
{
public:
wxBitmapButton() { Init(); }
wxBitmapButton() {}
wxBitmapButton(wxWindow *parent,
wxWindowID id,
@@ -30,8 +30,6 @@ public:
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
{
Init();
Create(parent, id, bitmap, pos, size, style, validator, name);
}
@@ -45,25 +43,6 @@ public:
const wxString& name = wxButtonNameStr);
protected:
// common part of all ctors
void Init()
{
m_disabledSetByUser =
m_hoverSetByUser = false;
}
// reimplement some base class virtuals
virtual void DoSetBitmap(const wxBitmap& bitmap, State which);
// true if disabled bitmap was set by user, false if we created it
// ourselves from the normal one
bool m_disabledSetByUser;
// true if hover bitmap was set by user, false if it was set from focused
// one
bool m_hoverSetByUser;
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapButton)
};

View File

@@ -9,8 +9,8 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_BUTTON_H_
#define _WX_BUTTON_H_
#ifndef _WX_MSW_BUTTON_H_
#define _WX_MSW_BUTTON_H_
// ----------------------------------------------------------------------------
// Pushbutton
@@ -47,22 +47,13 @@ public:
virtual wxWindow *SetDefault();
// overridden base class methods
virtual void SetLabel(const wxString& label);
virtual bool SetBackgroundColour(const wxColour &colour);
virtual bool SetForegroundColour(const wxColour &colour);
// implementation from now on
virtual void Command(wxCommandEvent& event);
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
virtual bool MSWCommand(WXUINT param, WXWORD id);
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
// returns true if the platform should explicitly apply a theme border
virtual bool CanApplyThemeBorder() const { return false; }
protected:
// send a notification event, return true if processed
bool SendClickEvent();
@@ -74,32 +65,8 @@ protected:
// set or unset BS_DEFPUSHBUTTON style
static void SetDefaultStyle(wxButton *btn, bool on);
// usually overridden base class virtuals
virtual wxSize DoGetBestSize() const;
virtual bool DoGetAuthNeeded() const;
virtual void DoSetAuthNeeded(bool show);
virtual wxBitmap DoGetBitmap(State which) const;
virtual void DoSetBitmap(const wxBitmap& bitmap, State which);
virtual wxSize DoGetBitmapMargins() const;
virtual void DoSetBitmapMargins(wxCoord x, wxCoord y);
virtual void DoSetBitmapPosition(wxDirection dir);
#if wxUSE_MARKUP
virtual bool DoSetLabelMarkup(const wxString& markup);
#endif // wxUSE_MARKUP
// Increases the passed in size to account for the button image.
//
// Should only be called if we do have a button, i.e. if m_imageData is
// non-NULL.
void AdjustForBitmapSize(wxSize& size) const;
class wxButtonImageData *m_imageData;
#if wxUSE_MARKUP
class wxMarkupText *m_markupText;
#endif // wxUSE_MARKUP
// true if the UAC symbol is shown
bool m_authNeeded;
@@ -107,19 +74,10 @@ protected:
private:
void Init()
{
m_imageData = NULL;
#if wxUSE_MARKUP
m_markupText = NULL;
#endif // wxUSE_MARKUP
m_authNeeded = false;
}
// Switches button into owner-drawn mode: this is used if we need to draw
// something not supported by the native control, such as using non default
// colours or a bitmap on pre-XP systems.
void MakeOwnerDrawn();
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxButton);
};
#endif // _WX_BUTTON_H_
#endif // _WX_MSW_BUTTON_H_

View File

@@ -89,6 +89,7 @@ public:
// as above, but takes reference DC as first argument to take resolution,
// size, font metrics etc. from
wxEXPLICIT
wxEnhMetaFileDC(const wxDC& referenceDC,
const wxString& filename = wxEmptyString,
int width = 0, int height = 0,

View File

@@ -23,6 +23,12 @@ public:
wxMSWFileSystemWatcher(const wxFileName& path,
int events = wxFSW_EVENT_ALL);
// Override the base class function to provide a much more efficient
// implementation for it using the platform native support for watching the
// entire directory trees.
virtual bool AddTree(const wxFileName& path, int events = wxFSW_EVENT_ALL,
const wxString& filter = wxEmptyString);
protected:
bool Init();
};

View File

@@ -82,7 +82,7 @@ protected:
wxString m_helpFile;
DECLARE_CLASS(wxCHMHelpController)
DECLARE_DYNAMIC_CLASS(wxCHMHelpController)
};
#endif // wxUSE_MS_HTML_HELP

View File

@@ -20,7 +20,7 @@
class WXDLLIMPEXP_CORE wxWinHelpController: public wxHelpControllerBase
{
DECLARE_CLASS(wxWinHelpController)
DECLARE_DYNAMIC_CLASS(wxWinHelpController)
public:
wxWinHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) {}

View File

@@ -25,6 +25,7 @@ class WXDLLIMPEXP_FWD_CORE wxFrame;
class WXDLLIMPEXP_FWD_CORE wxToolBar;
#endif
class wxMenuRadioItemsData;
// Not using a combined wxToolBar/wxMenuBar? then use
// a commandbar in WinCE .NET to implement the
@@ -63,13 +64,16 @@ public:
// implementation only from now on
// -------------------------------
virtual void Attach(wxMenuBarBase *menubar);
bool MSWCommand(WXUINT param, WXWORD id);
// get the native menu handle
WXHMENU GetHMenu() const { return m_hMenu; }
// Return the start and end position of the radio group to which the item
// at the given position belongs. Returns false if there is no radio group
// containing this position.
bool MSWGetRadioGroupRange(int pos, int *start, int *end) const;
#if wxUSE_ACCEL
// called by wxMenuBar to build its accel table from the accels of all menus
bool HasAccels() const { return !m_accels.empty(); }
@@ -122,15 +126,17 @@ private:
// common part of Append/Insert (behaves as Append is pos == (size_t)-1)
bool DoInsertOrAppend(wxMenuItem *item, size_t pos = (size_t)-1);
// terminate the current radio group, if any
void EndRadioGroup();
// This variable contains the description of the radio item groups and
// allows to find whether an item at the given position is part of the
// group and also where its group starts and ends.
//
// It is initially NULL and only allocated if we have any radio items.
wxMenuRadioItemsData *m_radioData;
// if true, insert a breal before appending the next item
bool m_doBreak;
// the position of the first item in the current radio group or -1
int m_startRadioGroup;
// the menu handle of this menu
WXHMENU m_hMenu;

View File

@@ -61,11 +61,6 @@ public:
// Win32 API
WXWPARAM GetMSWId() const;
// mark item as belonging to the given radio group
void SetAsRadioGroupStart();
void SetRadioGroupStart(int start);
void SetRadioGroupEnd(int end);
#if WXWIN_COMPATIBILITY_2_8
// compatibility only, don't use in new code
wxDEPRECATED(
@@ -130,18 +125,6 @@ private:
// common part of all ctors
void Init();
// the positions of the first and last items of the radio group this item
// belongs to or -1: start is the radio group start and is valid for all
// but first radio group items (m_isRadioGroupStart == false), end is valid
// only for the first one
union
{
int start;
int end;
} m_radioGroup;
// does this item start a radio group?
bool m_isRadioGroupStart;
#if wxUSE_OWNER_DRAWN
// item bitmaps

View File

@@ -3,7 +3,7 @@
// Purpose: wxMSW-specific wxPanel class.
// Author: Vadim Zeitlin
// Created: 2011-03-18
// RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $
// RCS-ID: $Id$
// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@@ -34,6 +34,8 @@ public:
Create(parent, winid, pos, size, style, name);
}
virtual ~wxPanel();
// This is overridden for MSW to return true for all panels that are child
// of a window with themed background (such as wxNotebook) which should
// show through the child panels.

View File

@@ -454,7 +454,7 @@ private:
void DoInit(HGDIOBJ hgdiobj) { m_hgdiobj = ::SelectObject(m_hdc, hgdiobj); }
public:
SelectInHDC() : m_hdc(NULL) { }
SelectInHDC() : m_hdc(NULL), m_hgdiobj(NULL) { }
SelectInHDC(HDC hdc, HGDIOBJ hgdiobj) : m_hdc(hdc) { DoInit(hgdiobj); }
void Init(HDC hdc, HGDIOBJ hgdiobj)

View File

@@ -50,7 +50,7 @@ public:
m_path);
}
}
delete m_overlapped;
free(m_overlapped);
}
bool IsOk() const
@@ -104,7 +104,6 @@ private:
wxDECLARE_NO_COPY_CLASS(wxFSWatchEntryMSW);
};
// ============================================================================
// wxFSWatcherImplMSW helper classes implementations
// ============================================================================
@@ -156,6 +155,48 @@ public:
return m_watches.insert(val).second;
}
// Removes a watch we're currently using. Notice that this doesn't happen
// immediately, CompleteRemoval() must be called later when it's really
// safe to delete the watch, i.e. after completion of the IO operation
// using it.
bool ScheduleForRemoval(const wxSharedPtr<wxFSWatchEntryMSW>& watch)
{
wxCHECK_MSG( m_iocp != INVALID_HANDLE_VALUE, false, "IOCP not init" );
wxCHECK_MSG( watch->IsOk(), false, "Invalid watch" );
const wxString path = watch->GetPath();
wxFSWatchEntries::iterator it = m_watches.find(path);
wxCHECK_MSG( it != m_watches.end(), false,
"Can't remove a watch we don't use" );
// We can't just delete the watch here as we can have pending events
// for it and if we destroyed it now, we could get a dangling (or,
// worse, reused to point to another object) pointer in ReadEvents() so
// just remember that this one should be removed when CompleteRemoval()
// is called later.
m_removedWatches.insert(wxFSWatchEntries::value_type(path, watch));
m_watches.erase(it);
return true;
}
// Really remove the watch previously passed to ScheduleForRemoval().
//
// It's ok to call this for a watch that hadn't been removed before, in
// this case we'll just return false and do nothing.
bool CompleteRemoval(wxFSWatchEntryMSW* watch)
{
wxFSWatchEntries::iterator it = m_removedWatches.find(watch->GetPath());
if ( it == m_removedWatches.end() )
return false;
// Removing the object from the map will result in deleting the watch
// itself as it's not referenced from anywhere else now.
m_removedWatches.erase(it);
return true;
}
// post completion packet
bool PostEmptyStatus()
{
@@ -203,7 +244,13 @@ protected:
}
HANDLE m_iocp;
// The hash containing all the wxFSWatchEntryMSW objects currently being
// watched keyed by their paths.
wxFSWatchEntries m_watches;
// Contains the watches which had been removed but are still pending.
wxFSWatchEntries m_removedWatches;
};

View File

@@ -303,20 +303,18 @@
// usually more limited) implementations are used which allows to avoid the
// dependency on the C++ run-time library.
//
// Default is 1 if compiler supports it. Currently this means not one of the
// compilers mentioned in wxUSE_STD_DEFAULT comment and also not VC6 as it
// needs non-default options for such build to avoid getting "fatal error
// C1076: compiler limit : internal heap limit reached; use /Zm to specify a
// higher limit" in its own standard headers, so you need to ensure you do
// increase the heap size before enabling this option for this compiler.
// Notice that the compilers mentioned in wxUSE_STD_DEFAULT comment above don't
// support using standard containers and that VC6 needs non-default options for
// such build to avoid getting "fatal error C1076: compiler limit : internal
// heap limit reached; use /Zm to specify a higher limit" in its own standard
// headers, so you need to ensure you do increase the heap size before enabling
// this option for this compiler.
//
// Recommended setting: 1 unless you use a system without good implementation
// of STL.
#if defined(_MSC_VER) && _MSC_VER < 1300
#define wxUSE_STD_CONTAINERS 0
#else
#define wxUSE_STD_CONTAINERS wxUSE_STD_DEFAULT
#endif
// Default is 0 for compatibility reasons.
//
// Recommended setting: 1 unless compatibility with the official wxWidgets
// build and/or the existing code is a concern.
#define wxUSE_STD_CONTAINERS 0
// Use standard C++ streams if 1 instead of wx streams in some places. If
// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the

View File

@@ -106,6 +106,10 @@ protected:
wxRect GetBoundingBox() const;
// Get the height and, if the pointers are non NULL, widths of both labels.
//
// Notice that the return value will be 0 if we don't have wxSL_LABELS
// style but we do fill widthMin and widthMax even if we don't have
// wxSL_MIN_MAX_LABELS style set so the caller should account for it.
int GetLabelsSize(int *widthMin = NULL, int *widthMax = NULL) const;
@@ -123,8 +127,6 @@ protected:
int m_pageSize;
int m_lineSize;
int m_tickFreq;
int m_minLabelWidth;
int m_maxLabelWidth;
// flag needed to detect whether we're getting THUMBRELEASE event because
// of dragging the thumb or scrolling the mouse wheel

View File

@@ -15,71 +15,11 @@
#include "wx/bitmap.h"
//-----------------------------------------------------------------------------
// wxBitmapToggleButton
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButtonBase
{
public:
// construction/destruction
wxBitmapToggleButton() { Init(); }
wxBitmapToggleButton(wxWindow *parent,
wxWindowID id,
const wxBitmap& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxCheckBoxNameStr)
{
Create(parent, id, label, pos, size, style, validator, name);
}
// Create the control
bool Create(wxWindow *parent,
wxWindowID id,
const wxBitmap& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxCheckBoxNameStr);
// Get/set the value
void SetValue(bool state);
bool GetValue() const;
// Set the label
virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); }
virtual void SetLabel(const wxBitmap& label);
bool Enable(bool enable = true);
protected:
void Init();
wxBitmap m_bitmap;
wxBitmap m_disabledBitmap;
bool m_capturing;
bool m_depressed,m_oldValue;
void OnPaint(wxPaintEvent &event);
void OnMouse(wxMouseEvent &event);
void OnChar(wxKeyEvent &event);
void OnSize(wxSizeEvent &event);
virtual wxSize DoGetBestSize() const;
private:
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
};
// Checkbox item (single checkbox)
class WXDLLIMPEXP_CORE wxToggleButton : public wxToggleButtonBase
{
public:
wxToggleButton() {}
wxToggleButton() { Init(); }
wxToggleButton(wxWindow *parent,
wxWindowID id,
const wxString& label,
@@ -104,23 +44,68 @@ public:
virtual void SetValue(bool value);
virtual bool GetValue() const ;
virtual void SetLabel(const wxString& label);
virtual bool MSWCommand(WXUINT param, WXWORD id);
virtual void Command(wxCommandEvent& event);
virtual State GetNormalState() const;
// returns true if the platform should explicitly apply a theme border
virtual bool CanApplyThemeBorder() const { return false; }
protected:
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
virtual wxSize DoGetBestSize() const;
virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
void Init();
// current state of the button (when owner-drawn)
bool m_state;
private:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton)
};
//-----------------------------------------------------------------------------
// wxBitmapToggleButton
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButton
{
public:
// construction/destruction
wxBitmapToggleButton() {}
wxBitmapToggleButton(wxWindow *parent,
wxWindowID id,
const wxBitmap& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxCheckBoxNameStr)
{
Create(parent, id, label, pos, size, style, validator, name);
}
// Create the control
bool Create(wxWindow *parent,
wxWindowID id,
const wxBitmap& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxCheckBoxNameStr);
// deprecated synonym for SetBitmapLabel()
wxDEPRECATED_INLINE( void SetLabel(const wxBitmap& bitmap),
SetBitmapLabel(bitmap); )
// prevent virtual function hiding
virtual void SetLabel(const wxString& label) { wxToggleButton::SetLabel(label); }
private:
DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
};
#endif // _WX_TOGGLEBUTTON_H_

View File

@@ -303,20 +303,18 @@
// usually more limited) implementations are used which allows to avoid the
// dependency on the C++ run-time library.
//
// Default is 1 if compiler supports it. Currently this means not one of the
// compilers mentioned in wxUSE_STD_DEFAULT comment and also not VC6 as it
// needs non-default options for such build to avoid getting "fatal error
// C1076: compiler limit : internal heap limit reached; use /Zm to specify a
// higher limit" in its own standard headers, so you need to ensure you do
// increase the heap size before enabling this option for this compiler.
// Notice that the compilers mentioned in wxUSE_STD_DEFAULT comment above don't
// support using standard containers and that VC6 needs non-default options for
// such build to avoid getting "fatal error C1076: compiler limit : internal
// heap limit reached; use /Zm to specify a higher limit" in its own standard
// headers, so you need to ensure you do increase the heap size before enabling
// this option for this compiler.
//
// Recommended setting: 1 unless you use a system without good implementation
// of STL.
#if defined(_MSC_VER) && _MSC_VER < 1300
#define wxUSE_STD_CONTAINERS 0
#else
#define wxUSE_STD_CONTAINERS wxUSE_STD_DEFAULT
#endif
// Default is 0 for compatibility reasons.
//
// Recommended setting: 1 unless compatibility with the official wxWidgets
// build and/or the existing code is a concern.
#define wxUSE_STD_CONTAINERS 0
// Use standard C++ streams if 1 instead of wx streams in some places. If
// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the

View File

@@ -366,7 +366,21 @@ public:
bool HandlePower(WXWPARAM wParam, WXLPARAM lParam, bool *vetoed);
// Window procedure
// The main body of common window proc for all wxWindow objects. It tries
// to handle the given message and returns true if it was handled (the
// appropriate return value is then put in result, which must be non-NULL)
// or false if it wasn't.
//
// This function should be overridden in any new code instead of
// MSWWindowProc() even if currently most of the code overrides
// MSWWindowProc() as it had been written before this function was added.
virtual bool MSWHandleMessage(WXLRESULT *result,
WXUINT message,
WXWPARAM wParam,
WXLPARAM lParam);
// Common Window procedure for all wxWindow objects: forwards to
// MSWHandleMessage() and MSWDefWindowProc() if the message wasn't handled.
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
// Calls an appropriate default window procedure